1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

LibWeb: Fix null dereference when assigning an ImageStyleValue via JS

When parsing a CSS value in the context of a CSSStyleDeclaration
camelCase property setter, we don't necessarily have a Document to
provide the CSS parser for context.

So the parser can't go assuming that there's always a Document in the
ParsingContext. And ImageStyleValue can't go assuming that there's
always a Document either. This will require some more work to get things
right, I'm just patching up the null dereference for now.
This commit is contained in:
Andreas Kling 2021-09-30 02:18:30 +02:00
parent 3006e15c94
commit 198bb322ef
4 changed files with 8 additions and 7 deletions

View file

@ -1727,7 +1727,7 @@ RefPtr<StyleValue> Parser::parse_image_value(ParsingContext const& context, Styl
{
auto url = parse_url_function(context, component_value);
if (url.has_value())
return ImageStyleValue::create(url.value(), *context.document());
return ImageStyleValue::create(url.value(), context.document());
// FIXME: Handle gradients.
return {};