From a95e7610247b1eb97fd195f4e566a7ad068b4219 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 7 Oct 2020 11:29:04 -0700 Subject: [PATCH] fix NPE I hope. Happens when there's a duplicate delete-deleted-game alert, and trying to close the view a second time may also be a problem. --- .../src/main/java/org/eehouse/android/xw4/BoardDelegate.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index db367a07c..083fb3ea2 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -269,6 +269,7 @@ public class BoardDelegate extends DelegateBase .setMessage( getString( R.string.msg_dev_deleted_fmt, gameName ) ) .setPositiveButton( android.R.string.ok, null ); lstnr = new OnClickListener() { + @Override public void onClick( DialogInterface dlg, int whichButton ) { deleteAndClose( gameID ); @@ -1684,7 +1685,9 @@ public class BoardDelegate extends DelegateBase private void deleteAndClose( int gameID ) { if ( null != m_gi && gameID == m_gi.gameID ) { - GameUtils.deleteGame( m_activity, m_jniThread.getLock(), false, false ); + if ( null != m_jniThread ) { + GameUtils.deleteGame( m_activity, m_jniThread.getLock(), false, false ); + } } else { Log.e( TAG, "deleteAndClose() called with wrong gameID %d", gameID ); }