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

LibWeb/CSS: Remove nullpointer dereference in Parser

On platinenmacher.tech there is a document without a window. During
size attribute parsing the window pointer is dereferenced which
causes a crash. This checks for the window to be actually there
before dereferencing.
This commit is contained in:
Bastian Neumann 2024-01-07 16:38:09 +01:00 committed by Sam Atkins
parent 343d6b001f
commit 7d63b8b95f
2 changed files with 3 additions and 2 deletions

View file

@ -56,7 +56,7 @@ AK::URL ParsingContext::complete_url(StringView relative_url) const
HTML::Window const* ParsingContext::window() const
{
return m_document ? &m_document->window() : nullptr;
return m_document && m_document->default_view() ? &m_document->window() : nullptr;
}
}