LibWeb: Don't crash when detached document tries to use system palette

If the current Document is not attached to a Web::Page for whatever
reason, but we're trying to look up a color from the system palette,
let's just fail the lookup instead of crashing the process.
This commit is contained in:
Andreas Kling 2022-03-19 18:09:22 +01:00
parent aa45cdf71d
commit f87edd4c14
Notes: sideshowbarker 2024-07-17 17:05:09 +09:00

View file

@ -1121,7 +1121,9 @@ Color IdentifierStyleValue::to_color(Layout::NodeWithStyle const& node) const
if (id() == CSS::ValueID::LibwebLink)
return document.link_color();
VERIFY(document.page());
if (!document.page())
return {};
auto palette = document.page()->palette();
switch (id()) {
case CSS::ValueID::LibwebPaletteDesktopBackground: