Android: handle errors in debug.cpp (#42)

master
Bektur 2022-02-27 15:55:50 +06:00 committed by GitHub
parent 299c0d211c
commit d974b14e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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