From 57aff416f0fb000a8fadaaf767df0fb6ec9abc97 Mon Sep 17 00:00:00 2001 From: Ryan Tremblay Date: Thu, 20 Feb 2025 15:16:29 -0800 Subject: [PATCH] If the constructor callback returns nullptr, return the JS object instance --- Core/Node-API/Source/js_native_api_javascriptcore.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Node-API/Source/js_native_api_javascriptcore.cc b/Core/Node-API/Source/js_native_api_javascriptcore.cc index 4069e4b7..ef8127f6 100644 --- a/Core/Node-API/Source/js_native_api_javascriptcore.cc +++ b/Core/Node-API/Source/js_native_api_javascriptcore.cc @@ -337,7 +337,7 @@ namespace { return nullptr; } - return ToJSObject(env, result); + return result != nullptr ? ToJSObject(env, result) : instance; } // JSObjectFinalizeCallback