Android: Fix crash in main activity

This commit is contained in:
Connor McLaughlin 2020-08-02 02:35:10 +10:00
parent 4bb4ec0494
commit 4137c9775e
2 changed files with 4 additions and 1 deletions

View file

@ -54,6 +54,9 @@ public class AndroidHostInterface
return mInstance != null;
}
static public boolean hasInstance() {
return mInstance != null;
}
static public AndroidHostInterface getInstance() {
return mInstance;
}

View file

@ -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");
}