From ba3e286781f7d3b27a782cca92663b533c69042a Mon Sep 17 00:00:00 2001 From: huangweichen Date: Tue, 19 Nov 2024 11:53:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9AI=E6=A3=80=E8=A7=86=E6=84=8F?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huangweichen Change-Id: I6c2304b4c56424b3e59d8c847e3546fd3ebd2edd --- adapter/ohos/capability/udmf/udmf_impl.cpp | 4 +++- adapter/ohos/entrance/mmi_event_convertor.cpp | 1 + frameworks/bridge/common/dom/dom_grid_row.cpp | 1 + frameworks/core/components_ng/event/focus_hub.cpp | 2 ++ .../components_ng/pattern/app_bar/atomic_service_pattern.cpp | 4 +++- frameworks/core/components_ng/pattern/stage/page_pattern.cpp | 4 +++- 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/adapter/ohos/capability/udmf/udmf_impl.cpp b/adapter/ohos/capability/udmf/udmf_impl.cpp index 6e9fd749447..ccbb2813d9d 100644 --- a/adapter/ohos/capability/udmf/udmf_impl.cpp +++ b/adapter/ohos/capability/udmf/udmf_impl.cpp @@ -76,7 +76,9 @@ napi_value UdmfClientImpl::TransformUdmfUnifiedData(RefPtr& Unified CHECK_NULL_RETURN(engine, nullptr); NativeEngine* nativeEngine = engine->GetNativeEngine(); napi_env env = reinterpret_cast(nativeEngine); - auto unifiedData = AceType::DynamicCast(UnifiedData)->GetUnifiedData(); + auto unifiedDataImpl = AceType::DynamicCast(UnifiedData); + CHECK_NULL_RETURN(unifiedDataImpl, nullptr); + auto unifiedData = unifiedDataImpl->GetUnifiedData(); CHECK_NULL_RETURN(unifiedData, nullptr); napi_value dataVal = nullptr; UDMF::UnifiedDataNapi::NewInstance(env, unifiedData, dataVal); diff --git a/adapter/ohos/entrance/mmi_event_convertor.cpp b/adapter/ohos/entrance/mmi_event_convertor.cpp index e2ea49a9d3f..323c58dc712 100644 --- a/adapter/ohos/entrance/mmi_event_convertor.cpp +++ b/adapter/ohos/entrance/mmi_event_convertor.cpp @@ -151,6 +151,7 @@ void UpdateMouseEventForPen(const MMI::PointerEvent::PointerItem& pointerItem, M TouchEvent ConvertTouchEvent(const std::shared_ptr& pointerEvent) { + CHECK_NULL_RETURN(pointerEvent, TouchEvent()); int32_t pointerID = pointerEvent->GetPointerId(); MMI::PointerEvent::PointerItem item; bool ret = pointerEvent->GetPointerItem(pointerID, item); diff --git a/frameworks/bridge/common/dom/dom_grid_row.cpp b/frameworks/bridge/common/dom/dom_grid_row.cpp index c2dc16ccd2d..1e7df15d722 100644 --- a/frameworks/bridge/common/dom/dom_grid_row.cpp +++ b/frameworks/bridge/common/dom/dom_grid_row.cpp @@ -27,6 +27,7 @@ void DomGridRow::SetParentGridInfo(const RefPtr& parent) { if (columnType_ != GridColumnType::NONE) { auto info = GridSystemManager::GetInstance().GetInfoByType(columnType_); + CHECK_NULL_VOID(info); gridContainerInfo_ = info->GetParent(); boxComponent_->SetGridLayoutInfo(gridContainerInfo_); } else { diff --git a/frameworks/core/components_ng/event/focus_hub.cpp b/frameworks/core/components_ng/event/focus_hub.cpp index 14299a2c725..6605135d415 100644 --- a/frameworks/core/components_ng/event/focus_hub.cpp +++ b/frameworks/core/components_ng/event/focus_hub.cpp @@ -37,6 +37,8 @@ float GetMoveOffset(const RefPtr& parentFrameNode, const RefPtrGetGeometryNode(); CHECK_NULL_RETURN(parentGeometryNode, notMove); auto parentFrameSize = parentGeometryNode->GetFrameSize(); diff --git a/frameworks/core/components_ng/pattern/app_bar/atomic_service_pattern.cpp b/frameworks/core/components_ng/pattern/app_bar/atomic_service_pattern.cpp index 8170b6b07fd..9ee965a288c 100644 --- a/frameworks/core/components_ng/pattern/app_bar/atomic_service_pattern.cpp +++ b/frameworks/core/components_ng/pattern/app_bar/atomic_service_pattern.cpp @@ -357,7 +357,9 @@ void AtomicServicePattern::UpdateIconLayout(RefPtr& theme, RefPtrGetIconInsideMargin()); margin.right = CalcLength(theme->GetIconOutsideMargin()); } - icon->GetLayoutProperty()->UpdateMargin(margin); + auto layoutProperty = icon->GetLayoutProperty(); + CHECK_NULL_VOID(layoutProperty); + layoutProperty->UpdateMargin(margin); icon->MarkModifyDone(); icon->MarkDirtyNode(); diff --git a/frameworks/core/components_ng/pattern/stage/page_pattern.cpp b/frameworks/core/components_ng/pattern/stage/page_pattern.cpp index 0cc53046f54..f7ed4eb9866 100644 --- a/frameworks/core/components_ng/pattern/stage/page_pattern.cpp +++ b/frameworks/core/components_ng/pattern/stage/page_pattern.cpp @@ -468,7 +468,9 @@ bool PagePattern::AvoidKeyboard() const { auto pipeline = PipelineContext::GetCurrentContext(); CHECK_NULL_RETURN(pipeline, false); - return pipeline->GetSafeAreaManager()->KeyboardSafeAreaEnabled(); + auto safeAreaManager = pipeline->GetSafeAreaManager(); + CHECK_NULL_RETURN(safeAreaManager, false); + return safeAreaManager->KeyboardSafeAreaEnabled(); } bool PagePattern::RemoveOverlay()