fix NPE: jniThread gets turned to null sometimes, so test

This commit is contained in:
Eric House 2013-11-29 07:26:30 -08:00
parent 2dd56d08af
commit d3ce4aa4c7

View file

@ -81,6 +81,8 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
@Override @Override
public boolean onTouchEvent( MotionEvent event ) public boolean onTouchEvent( MotionEvent event )
{ {
boolean wantMore = null != m_jniThread;
if ( wantMore ) {
int action = event.getAction(); int action = event.getAction();
int xx = (int)event.getX(); int xx = (int)event.getX();
int yy = (int)event.getY(); int yy = (int)event.getY();
@ -124,8 +126,8 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
DbgUtils.logf( "onTouchEvent: unknown action: %d", action ); DbgUtils.logf( "onTouchEvent: unknown action: %d", action );
break; break;
} }
}
return true; // required to get subsequent events return wantMore; // true required to get subsequent events
} }
// private void printMode( String comment, int mode ) // private void printMode( String comment, int mode )