From ef0c301e1a5fa0f5c3805f80d66a9db7f3219726 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 4 Mar 2012 08:18:54 -0800 Subject: [PATCH] fix NPEs that would occur if play and back buttons pressed at about the same time by ignoring the second if we've already closed the game being edited. --- .../XWords4/src/org/eehouse/android/xw4/GameConfig.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java index c55a196a6..f2683a635 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java @@ -577,7 +577,9 @@ public class GameConfig extends XWActivity public void onClick( View view ) { - if ( m_addPlayerButton == view ) { + if ( null == m_gameLock ) { + // do nothing; we're on the way out + } else if ( m_addPlayerButton == view ) { int curIndex = m_gi.nPlayers; if ( curIndex < CurGameInfo.MAX_NUM_PLAYERS ) { m_gi.addPlayer(); // ups nPlayers @@ -621,7 +623,9 @@ public class GameConfig extends XWActivity public boolean onKeyDown( int keyCode, KeyEvent event ) { boolean consumed = false; - if ( keyCode == KeyEvent.KEYCODE_BACK ) { + if ( null == m_gameLock ) { + // Do nothing; we're on our way out + } else if ( keyCode == KeyEvent.KEYCODE_BACK ) { saveChanges(); if ( !m_gameStarted ) { // no confirm needed applyChanges( true );