diff --git a/build/android/app/src/main/java/com/multicraft/game/helpers/Utilities.kt b/build/android/app/src/main/java/com/multicraft/game/helpers/Utilities.kt index d3cccb18f..0f48f0a6e 100644 --- a/build/android/app/src/main/java/com/multicraft/game/helpers/Utilities.kt +++ b/build/android/app/src/main/java/com/multicraft/game/helpers/Utilities.kt @@ -20,10 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., package com.multicraft.game.helpers -import android.app.Activity -import android.app.ActivityManager -import android.app.AlarmManager -import android.app.PendingIntent +import android.app.* import android.app.PendingIntent.FLAG_CANCEL_CURRENT import android.app.PendingIntent.FLAG_IMMUTABLE import android.content.Context diff --git a/build/android/build.gradle b/build/android/build.gradle index 45fd743e4..8f591179f 100644 --- a/build/android/build.gradle +++ b/build/android/build.gradle @@ -15,7 +15,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.1' + classpath 'com.android.tools.build:gradle:7.1.2' classpath 'de.undercouch:gradle-download-task:4.1.2' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10' // NOTE: Do not place your application dependencies here; they belong diff --git a/src/debug.cpp b/src/debug.cpp index 4e6800e07..a29761136 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -61,7 +61,7 @@ void sanity_check_fn(const char *assertion, const char *file, "\" in file: " + std::string(file) + ":" + std::to_string(line) + " (" + std::string(function) + ")"; - throw std::runtime_error(capture); + porting::finishGame(capture); #else abort(); #endif @@ -84,7 +84,7 @@ void fatal_error_fn(const char *msg, const char *file, "\" in file: " + std::string(file) + ":" + std::to_string(line) + " (" + std::string(function) + ")"; - throw std::runtime_error(capture); + porting::finishGame(capture); #else abort(); #endif diff --git a/src/porting_android.cpp b/src/porting_android.cpp index 5bc09720d..a46c2795a 100644 --- a/src/porting_android.cpp +++ b/src/porting_android.cpp @@ -356,6 +356,7 @@ void finishGame(const std::string &exc) jstring jexc = jnienv->NewStringUTF(exc.c_str()); jnienv->CallVoidMethod(app_global->activity->clazz, finishMe, jexc); + exit(0); } jstring getJniString(const std::string &message) diff --git a/src/porting_android.h b/src/porting_android.h index 0a9ccae50..8c62e4afe 100644 --- a/src/porting_android.h +++ b/src/porting_android.h @@ -94,7 +94,7 @@ float getDisplayDensity(); /** * call Android function to finish */ -void finishGame(const std::string &exc); +NORETURN void finishGame(const std::string &exc); /** * call Android function to handle not-critical error