diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index f05487d8a3..6362a06d5f 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1963,7 +1963,10 @@ void Document::check_favicon_after_loading_link_resource() { // https://html.spec.whatwg.org/multipage/links.html#rel-icon // NOTE: firefox also load favicons outside the head tag, which is against spec (see table 4.6.7) - auto head_element = head(); + auto* head_element = head(); + if (!head_element) + return; + auto favicon_link_elements = HTMLCollection::create(*head_element, [](Element const& element) { if (!is(element)) return false;