Android: Fix crash if activity is killed before returning

This commit is contained in:
Connor McLaughlin 2020-11-07 22:12:08 +10:00
parent c18278e664
commit 8f74d4718f
1 changed files with 6 additions and 0 deletions

View File

@ -235,6 +235,12 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (!AndroidHostInterface.hasInstanceAndEmulationThreadIsRunning()) {
// we must've got killed off in the background :(
finish();
return;
}
if (requestCode == REQUEST_CODE_SETTINGS) { if (requestCode == REQUEST_CODE_SETTINGS) {
if (AndroidHostInterface.getInstance().isEmulationThreadRunning()) if (AndroidHostInterface.getInstance().isEmulationThreadRunning())
applySettings(); applySettings();