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

LibWeb: Check that there's a head element before looking for favicons

This commit is contained in:
Luke Wilde 2022-11-05 15:14:05 +00:00 committed by Andreas Kling
parent 1d0fe2325c
commit dfad2d4c13

View file

@ -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<HTML::HTMLLinkElement>(element))
return false;