From b93d2b7be2b15780bfd534fb325d1cf12c16299b Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Wed, 2 Apr 2025 09:36:53 +0100 Subject: [PATCH] IDLGenerators: Don't attempt to set null `[PutForwards]` attribute Previously, attempting to set a `[PutForwards]` annotated attribute, would crash if the associated getter returned null. --- .../CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index d59306791b8..11437a71a2e 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -4249,7 +4249,8 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.setter_callback@) auto value = vm.argument(0); auto receiver = TRY(throw_dom_exception_if_needed(vm, [&]() { return impl->@attribute.cpp_name@(); })); - TRY(receiver->set(JS::PropertyKey { "@put_forwards_identifier@"_fly_string, JS::PropertyKey::StringMayBeNumber::No }, value, JS::Object::ShouldThrowExceptions::Yes)); + if (receiver != JS::js_null()) + TRY(receiver->set(JS::PropertyKey { "@put_forwards_identifier@"_fly_string, JS::PropertyKey::StringMayBeNumber::No }, value, JS::Object::ShouldThrowExceptions::Yes)); return JS::js_undefined(); }