From f9e8f0245103bf36b62d959a27f51b02d4c3e934 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 27 Mar 2022 21:02:24 +0200 Subject: [PATCH] LibWeb: Don't crash in IFC if very first chunk is collapsible whitespace --- Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 7e83192f45..69dcf5cc1e 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -232,7 +232,7 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode) auto& item = item_opt.value(); // Ignore collapsible whitespace chunks at the start of line, and if the last fragment already ends in whitespace. - if (item.is_collapsible_whitespace && line_boxes.last().is_empty_or_ends_in_whitespace()) + if (item.is_collapsible_whitespace && (line_boxes.is_empty() || line_boxes.last().is_empty_or_ends_in_whitespace())) continue; switch (item.type) {