LibWeb: Fix that empty event handlers return null instead of crashing

This commit is contained in:
davidot 2021-07-23 11:52:01 +02:00 committed by Andreas Kling
commit 4ef9edbff7
Notes: sideshowbarker 2024-07-18 08:29:58 +09:00

View file

@ -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 {