From 4ef9edbff7dffe82f515ad699bf6284113699fd0 Mon Sep 17 00:00:00 2001 From: davidot Date: Fri, 23 Jul 2021 11:52:01 +0200 Subject: [PATCH] LibWeb: Fix that empty event handlers return null instead of crashing --- Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index 395fc351f4..805ddf60a4 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -1437,6 +1437,9 @@ static @fully_qualified_name@* impl_from(JS::VM& vm, JS::GlobalObject& global_ob )~~~"); } else if (return_type.name == "EventHandler") { scoped_generator.append(R"~~~( + if (retval.callback.is_null()) + return JS::js_null(); + return retval.callback.cell(); )~~~"); } else {