From f0288e7f94c59bccbae7fe22fba794ccce6abfb4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 5 Jan 2024 22:38:29 +0100 Subject: [PATCH] LibWeb: Null check response body in load_fallback_favicon_if_needed() This fixes a null dereference seen sometimes when fetching a favicon doesn't work out as expected. --- Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index d05bf64505..30512ef41a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -504,7 +504,8 @@ WebIDL::ExceptionOr HTMLLinkElement::load_fallback_favicon_if_needed(JS::N }; // 3. Use response's unsafe response as an icon as if it had been declared using the icon keyword. - response->unsafe_response()->body()->fully_read(realm, move(process_body), move(process_body_error), global).release_value_but_fixme_should_propagate_errors(); + if (auto body = response->unsafe_response()->body()) + body->fully_read(realm, move(process_body), move(process_body_error), global).release_value_but_fixme_should_propagate_errors(); }; TRY(Fetch::Fetching::fetch(realm, request, Fetch::Infrastructure::FetchAlgorithms::create(vm, move(fetch_algorithms_input))));