From cf77872dd4f0daf55ba9ff23334c7b9e416b4048 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 22 Feb 2012 14:06:47 -0800 Subject: [PATCH] test for null object before calling method --- .../src/org/eehouse/android/xw4/BoardActivity.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 4034f838b..39f1fb777 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -808,14 +808,16 @@ public class BoardActivity extends XWActivity // BTService.BTEventListener interface ////////////////////////////////////////////////// @Override + @SuppressWarnings("fallthrough") public void eventOccurred( BTService.BTEvent event, final Object ... args ) { switch( event ) { case MESSAGE_ACCEPTED: - m_jniThread.handle( JNICmd.CMD_DRAW_BT_STATUS, true ); - break; case MESSAGE_REFUSED: - m_jniThread.handle( JNICmd.CMD_DRAW_BT_STATUS, false ); + if ( null != m_jniThread ) { + boolean accepted = BTService.BTEvent.MESSAGE_ACCEPTED == event; + m_jniThread.handle( JNICmd.CMD_DRAW_BT_STATUS, accepted ); + } break; case MESSAGE_NOGAME: post( new Runnable() {