Skip to content

Commit 1740f73

Browse files
committed
fix(ohos): apply mutation nullptr protect
1 parent d7ec13e commit 1740f73

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

framework/ohos/src/main/cpp/impl/renderer/native/src/native_render_manager.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,9 @@ void NativeRenderManager::MoveRenderNode_C(std::weak_ptr<RootNode> root_node, st
682682
}
683683
m->node_infos_.push_back(HRMoveNodeInfo(render_info.id, render_info.index));
684684
}
685-
c_render_provider_->MoveNode(root_id, m);
685+
if (m) {
686+
c_render_provider_->MoveNode(root_id, m);
687+
}
686688
}
687689

688690
void NativeRenderManager::DeleteRenderNode(std::weak_ptr<RootNode> root_node,

framework/ohos/src/main/cpp/impl/renderer/native/src/uimanager/hr_view_manager.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ void HRViewManager::ApplyMutations() {
196196
}
197197

198198
void HRViewManager::ApplyMutation(std::shared_ptr<HRMutation> &m) {
199+
if (!m) {
200+
FOOTSTONE_LOG(WARNING) << "Apply mutation, but m is nullptr";
201+
return;
202+
}
199203
if (m->type_ == HRMutationType::CREATE) {
200204
auto tm = std::static_pointer_cast<HRCreateMutation>(m);
201205
bool is_nine_img = false;

0 commit comments

Comments
 (0)