summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidot <david.tuin@gmail.com>2021-07-23 11:52:01 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-23 14:15:28 +0200
commit4ef9edbff7dffe82f515ad699bf6284113699fd0 (patch)
tree09c3ac558461478a2a9efe8a70995bdfddbca020
parent080112eb821d6a111697b1849295526828ab9dfc (diff)
downloadserenity-4ef9edbff7dffe82f515ad699bf6284113699fd0.zip
LibWeb: Fix that empty event handlers return null instead of crashing
-rw-r--r--Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp3
1 files changed, 3 insertions, 0 deletions
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 {