From 8f74d4718fadaf5960de9f4b53dbdc0d99714dbf Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 7 Nov 2020 22:12:08 +1000 Subject: [PATCH] Android: Fix crash if activity is killed before returning --- .../com/github/stenzek/duckstation/EmulationActivity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java index b9867236b..cad4ad342 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java @@ -235,6 +235,12 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent 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 (AndroidHostInterface.getInstance().isEmulationThreadRunning()) applySettings();