From 3bfdc4b077f2dbb33d73fa1ff746c5529ab77059 Mon Sep 17 00:00:00 2001 From: pfg Date: Tue, 18 Nov 2025 21:00:27 -0800 Subject: [PATCH] return fixes --- src/bun.js/bindings/SnapshotSerializers.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bun.js/bindings/SnapshotSerializers.cpp b/src/bun.js/bindings/SnapshotSerializers.cpp index f5f2386b14..4c0a255318 100644 --- a/src/bun.js/bindings/SnapshotSerializers.cpp +++ b/src/bun.js/bindings/SnapshotSerializers.cpp @@ -114,7 +114,7 @@ JSValue SnapshotSerializers::serialize(JSGlobalObject* globalObject, JSValue val // Check for re-entrancy if (m_isExecuting) { throwTypeError(globalObject, scope, "Cannot serialize from within a test or serialize callback"_s); - return jsNull(); + RELEASE_AND_RETURN(scope, {}); } // RAII guard to manage m_isExecuting flag @@ -184,7 +184,8 @@ JSValue SnapshotSerializers::serialize(JSGlobalObject* globalObject, JSValue val throwTypeError(globalObject, scope, "Snapshot serializer serialize callback must return a string"_s); RELEASE_AND_RETURN(scope, {}); } - RELEASE_AND_RETURN(scope, result); + + return result; } // No matching serializer found @@ -252,5 +253,5 @@ extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue SnapshotSerializers JSValue result = serializers->serialize(globalObject, value); RETURN_IF_EXCEPTION(scope, {}); - RELEASE_AND_RETURN(scope, JSValue::encode(result)); + return JSValue::encode(result); }