From 57feb0f3ec55990cbe942f082e045fa45ee6c189 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 11 Apr 2022 01:20:24 +0200 Subject: [PATCH] LibWeb: Add missing null check of independent formatting context in FFC When calling layout_inside() on a flex item that can't have children of its own, layout_inside() will not return an independent formatting context, so we need to handle that case here. --- Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index f493c44fc8..5adb2fbcfa 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -129,8 +129,8 @@ void FlexFormattingContext::run(Box const& run_box, LayoutMode layout_mode) // AD-HOC: Layout the inside of all flex items. copy_dimensions_from_flex_items_to_boxes(); for (auto& flex_item : m_flex_items) { - auto independent_formatting_context = layout_inside(flex_item.box, LayoutMode::Normal); - independent_formatting_context->parent_context_did_dimension_child_root_box(); + if (auto independent_formatting_context = layout_inside(flex_item.box, LayoutMode::Normal)) + independent_formatting_context->parent_context_did_dimension_child_root_box(); } // FIXME: We run the "copy dimensions" step *again* here, in order to override any sizes