Skip to content

Commit 27f17e5

Browse files
authored
Add additional constructor callback check for nullptr (#105)
If a JS object constructor is defined natively, and the native callback returns nullptr, we should return the JS object instance instead of nullptr. This behavior should match what happens with other JS engines by default.
1 parent 6c1fba4 commit 27f17e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Core/Node-API/Source/js_native_api_javascriptcore.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ namespace {
337337
return nullptr;
338338
}
339339

340-
return ToJSObject(env, result);
340+
return result != nullptr ? ToJSObject(env, result) : instance;
341341
}
342342

343343
// JSObjectFinalizeCallback

0 commit comments

Comments
 (0)