diff --git a/frameworks/core/components_ng/pattern/grid_row/grid_row_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/grid_row/grid_row_layout_algorithm.cpp index 11bb9d60a5b5f070950e8d12c4fee1246677591a..3f404f6dfe880d7008b0c0ffc33f8e0656cfdb42 100644 --- a/frameworks/core/components_ng/pattern/grid_row/grid_row_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/grid_row/grid_row_layout_algorithm.cpp @@ -259,7 +259,7 @@ void GridRowLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper) CHECK_NULL_VOID(windowManager); auto mode = windowManager->GetWindowMode(); auto sizeType = GridContainerUtils::ProcessGridSizeType(layoutProperty->GetBreakPointsValue(), - Size(maxSize.Width(), maxSize.Height()), mode, PipelineBase::GetCurrentContext()); + Size(maxSize.Width(), maxSize.Height()), mode, PipelineBase::GetCurrentContextSafelyWithCheck()); if (hostLayoutProperty->GetSizeTypeValue(V2::GridSizeType::UNDEFINED) != sizeType) { OnBreakPointChange(layoutWrapper, sizeType); } diff --git a/frameworks/core/components_v2/grid_layout/grid_container_utils.cpp b/frameworks/core/components_v2/grid_layout/grid_container_utils.cpp index 5678f0e8373930eea145ee482735aee9fab97f82..5b44c1de57d64275c4ef7e58214a129e85d8bee9 100644 --- a/frameworks/core/components_v2/grid_layout/grid_container_utils.cpp +++ b/frameworks/core/components_v2/grid_layout/grid_container_utils.cpp @@ -48,6 +48,10 @@ GridSizeType GridContainerUtils::ProcessGridSizeType(const V2::BreakPoints& brea auto threshold = ParseBreakpoints(breakpoints); double windowWidth = 0.0; if (breakpoints.reference == BreakPointsReference::WindowSize) { + if (!pipeline) { + TAG_LOGI(AceLogTag::ACE_GRIDROW, "pipeline is null"); + return GridSizeType::UNDEFINED; + } windowWidth = pipeline->GetDisplayWindowRectInfo().GetSize().Width(); if (mode == WindowMode::WINDOW_MODE_FLOATING) { windowWidth -= 2 * (CONTAINER_BORDER_WIDTH + CONTENT_PADDING).ConvertToPx(); @@ -70,6 +74,7 @@ GridSizeType GridContainerUtils::ProcessGridSizeType( { auto threshold = ParseBreakpoints(breakpoints); double windowWidth = 0.0; + CHECK_NULL_RETURN(pipeline, GridSizeType::UNDEFINED); if (breakpoints->reference == BreakPointsReference::WindowSize) { windowWidth = GridSystemManager::GetInstance().GetScreenWidth(); auto windowManager = pipeline->GetWindowManager();