avoid crash by dropping GAME_OVER event

Play Store reports say I'm getting this event when I don't have a
valid jni game instance to work with. So test for that, and drop the
event. If it's a race condition this should fix it. If not I'll get
some other crash report that might be more useful.
This commit is contained in:
Eric House 2021-05-27 10:56:21 -07:00
parent dd8e7584e6
commit e18b2d5c75

View file

@ -2232,16 +2232,19 @@ public class BoardDelegate extends DelegateBase
runOnUiThread( new Runnable() {
@Override
public void run() {
Assert.assertTrue( m_jniGamePtr.isRetained() );
boolean hasPending = 0 < XwJNI.
comms_countPendingPackets( m_jniGamePtr );
mGameOverAlert = GameOverAlert
.newInstance( m_summary,
msg.arg1,
(String)msg.obj,
hasPending,
inArchiveGroup() );
show( mGameOverAlert );
Log.d( TAG, "makeJNIHandler(): handling GAME_OVER" );
Assert.assertTrueNR( m_jniGamePtr.isRetained() );
if ( m_jniGamePtr.isRetained() ) {
boolean hasPending = 0 < XwJNI.
comms_countPendingPackets( m_jniGamePtr );
mGameOverAlert = GameOverAlert
.newInstance( m_summary,
msg.arg1,
(String)msg.obj,
hasPending,
inArchiveGroup() );
show( mGameOverAlert );
}
}
} );
}