diff --git a/src/main/java/de/thm/arsnova/services/SessionService.java b/src/main/java/de/thm/arsnova/services/SessionService.java index e77c2b90a1395632ef07eb668f86dc02cf1d4f62..bf43823c7625ebec5a83457ed50ec2590e5a24a3 100644 --- a/src/main/java/de/thm/arsnova/services/SessionService.java +++ b/src/main/java/de/thm/arsnova/services/SessionService.java @@ -111,7 +111,7 @@ public class SessionService implements ISessionService { public final Session joinSession(final String keyword, final UUID socketId) { /* Socket.IO solution */ - Session session = databaseDao.getSessionFromKeyword(keyword); + Session session = null != keyword ? databaseDao.getSessionFromKeyword(keyword) : null; if (null == session) { userService.removeUserFromSessionBySocketId(socketId); diff --git a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java index c925e80ddd34407ed244b67aaea67d0d5fda169f..2cb748b7c183b3ae23f68633ca7991005dd09d64 100644 --- a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java +++ b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java @@ -157,9 +157,6 @@ public class ARSnovaSocketIOServer implements ApplicationListener<NovaEvent>, No if (session.getKeyword() == oldSessionKey) { return; } - if (null != oldSessionKey) { - reportActiveUserCountForSession(oldSessionKey); - } if (null != sessionService.joinSession(session.getKeyword(), client.getSessionId())) { /* active user count has to be sent to the client since the broadcast is @@ -167,6 +164,9 @@ public class ARSnovaSocketIOServer implements ApplicationListener<NovaEvent>, No reportActiveUserCountForSession(session.getKeyword()); reportSessionDataToClient(session.getKeyword(), u, client); } + if (null != oldSessionKey) { + reportActiveUserCountForSession(oldSessionKey); + } } });