Skip to content

Commit

Permalink
fix(dom): get scope return nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
ilikethese authored and hippy-actions[bot] committed Sep 19, 2023
1 parent 28a0e36 commit 54753a2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ std::shared_ptr<Scope> GetScope(jint j_scope_id) {
std::any scope_object;
auto scope_id = footstone::checked_numeric_cast<jint, uint32_t>(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<std::shared_ptr<Scope>>(scope_object);
}

Expand Down Expand Up @@ -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<jint, uint32_t>(j_root_id);
std::shared_ptr<RootNode> root_node;
auto& persistent_map = RootNode::PersistentMap();
Expand Down

0 comments on commit 54753a2

Please sign in to comment.