Add leaveRoom null check incase player is offline

This commit is contained in:
Treeku
2014-06-16 21:41:22 +01:00
parent 252c30df21
commit 1fa0070021
+4 -2
View File
@@ -990,8 +990,10 @@ public class ChatService implements INetworkDispatch {
if (playerName.contains(" "))
playerName = playerName.split(" ")[0];
ChatOnEnteredRoom leaveRoom = new ChatOnEnteredRoom(playerName, 0, roomId, false);
player.getClient().getSession().write(leaveRoom.serialize());
if (player != null && player.getClient() != null && player.getClient().getSession() != null) {
ChatOnEnteredRoom leaveRoom = new ChatOnEnteredRoom(playerName, 0, roomId, false);
player.getClient().getSession().write(leaveRoom.serialize());
}
room.getUserList().remove(playerName);