summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2021-06-14 22:17:48 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-06-14 22:17:48 +0000
commit46bf419ba21c13b1405623729b1067d8fd2f1ebe (patch)
tree95bbf288413100139a3572a400b60ef20ca88f25
parenteb872591101db7a850dd3e95b2e53d4a3b6c3224 (diff)
parent489d49d32512b51d717de714c64c8b903d431f5e (diff)
Merge "Fix NativeThemeRebase null abort" into sc-dev
-rw-r--r--core/jni/android_util_AssetManager.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 73e7d86e8279..e93b00d7b148 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -1282,6 +1282,8 @@ static void NativeThemeRebase(JNIEnv* env, jclass /*clazz*/, jlong ptr, jlong th
if (style_id_args == nullptr) {
return;
}
+ } else {
+ CHECK(style_count == 0) << "style_ids is null while style_count is non-zero";
}
jboolean* force_args = nullptr;
@@ -1292,12 +1294,18 @@ static void NativeThemeRebase(JNIEnv* env, jclass /*clazz*/, jlong ptr, jlong th
env->ReleasePrimitiveArrayCritical(style_ids, style_id_args, JNI_ABORT);
return;
}
+ } else {
+ CHECK(style_count == 0) << "force is null while style_count is non-zero";
}
auto theme = reinterpret_cast<Theme*>(theme_ptr);
theme->Rebase(&(*assetmanager), style_id_args, force_args, static_cast<size_t>(style_count));
- env->ReleasePrimitiveArrayCritical(style_ids, style_id_args, JNI_ABORT);
- env->ReleasePrimitiveArrayCritical(force, force_args, JNI_ABORT);
+ if (style_ids != nullptr) {
+ env->ReleasePrimitiveArrayCritical(style_ids, style_id_args, JNI_ABORT);
+ }
+ if (force != nullptr) {
+ env->ReleasePrimitiveArrayCritical(force, force_args, JNI_ABORT);
+ }
}
static void NativeThemeCopy(JNIEnv* env, jclass /*clazz*/, jlong dst_asset_manager_ptr,