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() { runOnUiThread( new Runnable() {
@Override @Override
public void run() { public void run() {
Assert.assertTrue( m_jniGamePtr.isRetained() ); Log.d( TAG, "makeJNIHandler(): handling GAME_OVER" );
boolean hasPending = 0 < XwJNI. Assert.assertTrueNR( m_jniGamePtr.isRetained() );
comms_countPendingPackets( m_jniGamePtr ); if ( m_jniGamePtr.isRetained() ) {
mGameOverAlert = GameOverAlert boolean hasPending = 0 < XwJNI.
.newInstance( m_summary, comms_countPendingPackets( m_jniGamePtr );
msg.arg1, mGameOverAlert = GameOverAlert
(String)msg.obj, .newInstance( m_summary,
hasPending, msg.arg1,
inArchiveGroup() ); (String)msg.obj,
show( mGameOverAlert ); hasPending,
inArchiveGroup() );
show( mGameOverAlert );
}
} }
} ); } );
} }