From c172a0aa0c3950ab858ad4acd498f9ca9f5bc64c Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 6 Dec 2018 06:23:40 -0800 Subject: [PATCH] fix NPE (race condition around deletion?) Check for null. Not sure how I got it there, but there's little harm in failing silently. --- .../main/java/org/eehouse/android/xw4/GameUtils.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java index ba3d807d5..2df7fd7f9 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java @@ -274,9 +274,13 @@ public class GameUtils { public static void deleteGame( Context context, GameLock lock, boolean informNow ) { - tellDied( context, lock, informNow ); - Utils.cancelNotification( context, (int)lock.getRowid() ); - DBUtils.deleteGame( context, lock ); + if ( null != lock ) { + tellDied( context, lock, informNow ); + Utils.cancelNotification( context, (int)lock.getRowid() ); + DBUtils.deleteGame( context, lock ); + } else { + Log.e( TAG, "deleteGame(): null lock; doing nothing" ); + } } public static boolean deleteGame( Context context, long rowid,