From dcb4968ed99b9c5dddd7589d731a5a491111bb8d Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 13 Jul 2016 17:08:39 -0700 Subject: [PATCH] fix NPE I think I'm in a bad state when this happens, but no point in crashing regardless. --- .../XWords4/src/org/eehouse/android/xw4/MainActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java index 4f71e7c97..4c99f3fd2 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java @@ -184,8 +184,8 @@ public class MainActivity extends XWActivity View child = m_root.getChildAt( m_root.getChildCount() - 1 ); Fragment frag = getSupportFragmentManager() .findFragmentById( child.getId() ); - boolean handled = ((XWFragment)frag).getDelegate() - .handleBackPressed(); + boolean handled = null != frag + &&((XWFragment)frag).getDelegate().handleBackPressed(); return handled; }