From 53cda988f4827197ae4cf0df893ea0ec60ca9d1f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 7 Dec 2023 14:30:40 -0800 Subject: [PATCH] Clear any errors from a previous run The error is thread-local, and the java thread may run onCreate initialization multiple times depending on the Android life cycle --- src/core/android/SDL_android.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 63bd79d652..c34c301105 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -573,6 +573,9 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeSetupJNI()"); + /* Start with a clean slate */ + SDL_ClearError(); + /* * Create mThreadKey so we can keep track of the JNIEnv assigned to each thread * Refer to http://developer.android.com/guide/practices/design/jni.html for the rationale behind this