Browse Source

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.
Andreas Kling 3 years ago
parent
commit
57feb0f3ec
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp

+ 2 - 2
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.
     // AD-HOC: Layout the inside of all flex items.
     copy_dimensions_from_flex_items_to_boxes();
     copy_dimensions_from_flex_items_to_boxes();
     for (auto& flex_item : m_flex_items) {
     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
     // FIXME: We run the "copy dimensions" step *again* here, in order to override any sizes