1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:38:13 +00:00

LibWeb: Null check fonts after parsing them in CRC2D.font assignment

Fixes an issue where setting CRC2D.font to an unparseable value would
assert due to a null dereference.
This commit is contained in:
Andreas Kling 2023-08-17 08:46:38 +02:00
parent ef6a78518f
commit f34cc0b8e3
3 changed files with 14 additions and 1 deletions

View file

@ -45,7 +45,7 @@ public:
auto font_style_value_result = parse_css_value(parsing_context, font, CSS::PropertyID::Font);
// If the new value is syntactically incorrect (including using property-independent style sheet syntax like 'inherit' or 'initial'), then it must be ignored, without assigning a new font value.
if (font_style_value_result.is_error()) {
if (font_style_value_result.is_error() || !font_style_value_result.value()) {
return;
}
my_drawing_state().font_style_value = font_style_value_result.value();