From 57f82c029c1f66c516650d96c176ba0f47da0f78 Mon Sep 17 00:00:00 2001 From: rmg-x Date: Sat, 19 Oct 2024 15:41:29 -0500 Subject: [PATCH] LibWeb/HTML: Check if evaluationStatus has a value before dereferencing Previously, we would crash if scripting was disabled and a javascript URL was evaluated. --- Userland/Libraries/LibWeb/HTML/Navigable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp index 12ed05b39b2..de54260e6a9 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp @@ -1603,7 +1603,7 @@ WebIDL::ExceptionOr> Navigable::evaluate_javascript_url String result; // 9. If evaluationStatus is a normal completion, and evaluationStatus.[[Value]] is a String, then set result to evaluationStatus.[[Value]]. - if (evaluation_status.type() == JS::Completion::Type::Normal && evaluation_status.value()->is_string()) { + if (evaluation_status.type() == JS::Completion::Type::Normal && evaluation_status.value().has_value() && evaluation_status.value()->is_string()) { result = evaluation_status.value()->as_string().utf8_string(); } else { // 10. Otherwise, return null.