fix (by inspection) three Play store crashes

One race condition between BT threads; two edge cases around dialog
fragments, where I've left DEBUG build asserts in place.
This commit is contained in:
Eric House 2017-05-24 21:27:18 -07:00
parent 935932f440
commit d584c30a43
3 changed files with 14 additions and 9 deletions

View file

@ -489,6 +489,8 @@ public class BTService extends XWService {
Log.w( TAG, "trying again..." );
logIOE( ioe);
continue;
} catch ( NullPointerException npe ) {
continue; // m_serverSocket probably null
}
}

View file

@ -122,18 +122,21 @@ public class DBAlert extends XWDialogFragment {
new Handler().post( new Runnable() {
@Override
public void run() {
MainActivity activity = (MainActivity)getActivity();
if ( null != activity ) {
DBAlert newMe = newInstance( getDlgID(), mParams );
activity.show( newMe );
dismiss(); // kill myself...
} else {
Log.d( TAG, "null activity..." );
try {
MainActivity activity = (MainActivity)getActivity();
if ( null != activity ) {
DBAlert newMe = newInstance( getDlgID(), mParams );
activity.show( newMe );
dismiss(); // kill myself...
} else {
Log.d( TAG, "null activity..." );
}
} catch ( IllegalStateException ex ) {
Assert.assertFalse( BuildConfig.DEBUG );
}
}
} );
}
return dialog;
}
}

View file

@ -341,7 +341,7 @@ public class GameConfigDelegate extends DelegateBase
break;
}
Assert.assertNotNull( dialog );
Assert.assertTrue( dialog != null || !BuildConfig.DEBUG );
return dialog;
} // makeDialog