summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/FunctionObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/FunctionObject.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/FunctionObject.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/FunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/FunctionObject.cpp
index 341ac80169..872542be61 100644
--- a/Userland/Libraries/LibJS/Runtime/FunctionObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/FunctionObject.cpp
@@ -76,9 +76,10 @@ void FunctionObject::InstanceField::define_field(VM& vm, Object& receiver) const
{
Value init_value = js_undefined();
if (initializer) {
- init_value = vm.call(*initializer, receiver.value_of());
- if (vm.exception())
+ auto init_value_or_error = vm.call(*initializer, receiver.value_of());
+ if (init_value_or_error.is_error())
return;
+ init_value = init_value_or_error.release_value();
}
receiver.create_data_property_or_throw(name, init_value);
}