From dfad2d4c13d62d5221f8792ec7ca14a2378a0b17 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Sat, 5 Nov 2022 15:14:05 +0000 Subject: [PATCH] LibWeb: Check that there's a head element before looking for favicons --- Userland/Libraries/LibWeb/DOM/Document.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;