From 4137c9775ecfe4256f534782be2b95371867989a Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 2 Aug 2020 02:35:10 +1000 Subject: [PATCH] Android: Fix crash in main activity --- .../com/github/stenzek/duckstation/AndroidHostInterface.java | 3 +++ .../main/java/com/github/stenzek/duckstation/MainActivity.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/AndroidHostInterface.java b/android/app/src/main/java/com/github/stenzek/duckstation/AndroidHostInterface.java index 35512af6a..59231f01e 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/AndroidHostInterface.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/AndroidHostInterface.java @@ -54,6 +54,9 @@ public class AndroidHostInterface return mInstance != null; } + static public boolean hasInstance() { + return mInstance != null; + } static public AndroidHostInterface getInstance() { return mInstance; } diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/MainActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/MainActivity.java index 8b28a4078..95d2fe8cd 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/MainActivity.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/MainActivity.java @@ -44,7 +44,7 @@ public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (!AndroidHostInterface.createInstance(this)) { + if (!AndroidHostInterface.hasInstance() && !AndroidHostInterface.createInstance(this)) { Log.i("MainActivity", "Failed to create host interface"); throw new RuntimeException("Failed to create host interface"); }