Avoided null pointer exception by adding an if statement

This commit is contained in:
Seraina 2022-04-14 15:05:00 +02:00
parent b37916134a
commit 2f79b41618

View File

@ -461,8 +461,9 @@ public class ClientHandler implements Runnable {
*/
public void disconnectClient() {
Lobby l = getLobby();
if (l != null) {
Game g = l.getGame();
if (l != null && g != null) {
if(g != null)
l.getGame().getGameState().handleClientDisconnect(this);
}
socket = this.getSocket();