diff --git a/app/src/app_android.cc b/app/src/app_android.cc index 3f7c9beaa5..ecd4f27c14 100644 --- a/app/src/app_android.cc +++ b/app/src/app_android.cc @@ -311,7 +311,13 @@ static jobject GetPlatformAppByName(JNIEnv* jni_env, const char* name) { name_string); jni_env->DeleteLocalRef(name_string); } - jni_env->ExceptionCheck(); + if (jni_env->ExceptionCheck()) { + // Explicitly set `platform_app` to `NULL` if an exception was thrown + // because on KitKat (API 19) `CallStaticObjectMethod()` may return garbage + // instead of `NULL` if an exception was thrown, and callers of this + // function expect `NULL` to be returned if the app was not found. + platform_app = NULL; // NOLINT + } jni_env->ExceptionClear(); return platform_app; } diff --git a/release_build_files/readme.md b/release_build_files/readme.md index d34e72e0c1..c13841e8ad 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -378,7 +378,10 @@ code. API. - Remote Config(Android): Fix for getting Remote Config instance for a specific app object. - ([#991](https://github.com/firebase/quickstart-unity/issues/991). + ([#991](https://github.com/firebase/quickstart-unity/issues/991)). + - General (Android): Fixed a potential SIGABRT when an app was created + with a non-default app name on Android KitKat + ([#429](https://github.com/firebase/firebase-cpp-sdk/pull/429)). ### 7.3.0 - Changes