From 54753a29f3e650258236bbc253c65d9036eb3007 Mon Sep 17 00:00:00 2001 From: ilikethese Date: Tue, 19 Sep 2023 20:14:59 +0800 Subject: [PATCH] fix(dom): get scope return nullptr --- .../connector/driver/js/src/main/cpp/src/js_driver_jni.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/android/connector/driver/js/src/main/cpp/src/js_driver_jni.cc b/framework/android/connector/driver/js/src/main/cpp/src/js_driver_jni.cc index 90d3a6914ff..2bb53ffc589 100644 --- a/framework/android/connector/driver/js/src/main/cpp/src/js_driver_jni.cc +++ b/framework/android/connector/driver/js/src/main/cpp/src/js_driver_jni.cc @@ -145,7 +145,10 @@ std::shared_ptr GetScope(jint j_scope_id) { std::any scope_object; auto scope_id = footstone::checked_numeric_cast(j_scope_id); auto flag = hippy::global_data_holder.Find(scope_id, scope_object); - FOOTSTONE_CHECK(flag); + if (!flag) { + FOOTSTONE_LOG(ERROR) << "Can't find scope, scope id = " << scope_id; + return nullptr; + } return std::any_cast>(scope_object); } @@ -461,6 +464,7 @@ void SetRootNode(__unused JNIEnv* j_env, jint j_scope_id, jint j_root_id) { auto scope = GetScope(j_scope_id); + if (scope == nullptr) return; auto root_id = footstone::check::checked_numeric_cast(j_root_id); std::shared_ptr root_node; auto& persistent_map = RootNode::PersistentMap();