diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-no-paintable.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-no-paintable.txt new file mode 100644 index 00000000000..47a5310842d --- /dev/null +++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-no-paintable.txt @@ -0,0 +1 @@ +PASS (didn't crash) \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/css/getComputedStyle-no-paintable.html b/Tests/LibWeb/Text/input/css/getComputedStyle-no-paintable.html new file mode 100644 index 00000000000..59895287277 --- /dev/null +++ b/Tests/LibWeb/Text/input/css/getComputedStyle-no-paintable.html @@ -0,0 +1,15 @@ + + + diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 005c7482f84..47680296e76 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -523,14 +523,18 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_propert // For grid-template-columns and grid-template-rows the resolved value is the used value. // https://www.w3.org/TR/css-grid-2/#resolved-track-list-standalone if (property_id == PropertyID::GridTemplateColumns) { - auto const& paintable_box = verify_cast(*layout_node.paintable()); - if (auto used_values_for_grid_template_columns = paintable_box.used_values_for_grid_template_columns()) { - return used_values_for_grid_template_columns; + if (layout_node.paintable()) { + auto const& paintable_box = verify_cast(*layout_node.paintable()); + if (auto used_values_for_grid_template_columns = paintable_box.used_values_for_grid_template_columns()) { + return used_values_for_grid_template_columns; + } } } else if (property_id == PropertyID::GridTemplateRows) { - auto const& paintable_box = verify_cast(*layout_node.paintable()); - if (auto used_values_for_grid_template_rows = paintable_box.used_values_for_grid_template_rows()) { - return used_values_for_grid_template_rows; + if (layout_node.paintable()) { + auto const& paintable_box = verify_cast(*layout_node.paintable()); + if (auto used_values_for_grid_template_rows = paintable_box.used_values_for_grid_template_rows()) { + return used_values_for_grid_template_rows; + } } }