Fix an NPE when logging out while in a game.

The fix for #124 apparently introduced another bug wherein logging out while playing in a game caused an NPE while ensuring that the user was also not spectating the game. Hold onto that value a little bit longer to make sure we can call that method as well, even though it shouldn't need to be called at that point (but an NPE is worse).
This commit is contained in:
Andy Janata 2018-03-23 14:41:31 -07:00
parent 88bfa34898
commit 0cf261f6e4
1 changed files with 3 additions and 2 deletions

View File

@ -294,8 +294,9 @@ public class User {
*/
public void noLongerValid() {
if (currentGame != null) {
currentGame.removePlayer(this);
currentGame.removeSpectator(this);
final Game game = currentGame;
game.removePlayer(this);
game.removeSpectator(this);
}
valid = false;
}