Fixed a possible null pointer exception.

This commit is contained in:
LevelX2 2016-09-29 16:20:29 +02:00
parent e49c92e80c
commit ca39289a3a

View file

@ -558,8 +558,12 @@ public class MageServerImpl implements MageServer {
execute("leaveChat", sessionId, new Action() {
@Override
public void execute() {
UUID userId = SessionManager.getInstance().getSession(sessionId).getUserId();
ChatManager.getInstance().leaveChat(chatId, userId);
if (chatId != null) {
UUID userId = SessionManager.getInstance().getSession(sessionId).getUserId();
ChatManager.getInstance().leaveChat(chatId, userId);
} else {
logger.warn("The chatId is null. sessionId = " + sessionId);
}
}
});
}