You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fix issue causing the project manager to crash because of missing path argument
In the process, the initialization logic is updated to show an error message and gracefully close the engine when setup errors occur.
This commit is contained in:
@@ -165,7 +165,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_ondestroy(JNIEnv *env
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jclass clazz, jobjectArray p_cmdline) {
|
||||
JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jclass clazz, jobjectArray p_cmdline) {
|
||||
setup_android_thread();
|
||||
|
||||
const char **cmdline = nullptr;
|
||||
@@ -175,10 +175,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jc
|
||||
cmdlen = env->GetArrayLength(p_cmdline);
|
||||
if (cmdlen) {
|
||||
cmdline = (const char **)memalloc((cmdlen + 1) * sizeof(const char *));
|
||||
ERR_FAIL_NULL_MSG(cmdline, "Out of memory.");
|
||||
ERR_FAIL_NULL_V_MSG(cmdline, false, "Out of memory.");
|
||||
cmdline[cmdlen] = nullptr;
|
||||
j_cmdline = (jstring *)memalloc(cmdlen * sizeof(jstring));
|
||||
ERR_FAIL_NULL_MSG(j_cmdline, "Out of memory.");
|
||||
ERR_FAIL_NULL_V_MSG(j_cmdline, false, "Out of memory.");
|
||||
|
||||
for (int i = 0; i < cmdlen; i++) {
|
||||
jstring string = (jstring)env->GetObjectArrayElement(p_cmdline, i);
|
||||
@@ -203,12 +203,13 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jc
|
||||
|
||||
// Note: --help and --version return ERR_HELP, but this should be translated to 0 if exit codes are propagated.
|
||||
if (err != OK) {
|
||||
return; // should exit instead and print the error
|
||||
return false;
|
||||
}
|
||||
|
||||
java_class_wrapper = memnew(JavaClassWrapper(godot_java->get_activity()));
|
||||
ClassDB::register_class<JNISingleton>();
|
||||
_initialize_java_modules();
|
||||
return true;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, jclass clazz, jint width, jint height) {
|
||||
|
||||
Reference in New Issue
Block a user