From ec11ea4e73baee87bb81784d7b1a74b5c3c01213 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 16 Jan 2025 16:06:32 -0800 Subject: [PATCH] Simplify .protect & unprotect (#16441) --- src/bun.js/bindings/bindings.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index 3389c2f85f..7081539580 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -4322,12 +4322,12 @@ pub const JSValue = enum(i64) { } pub fn protect(this: JSValue) void { - if (this.isEmptyOrUndefinedOrNull() or this.isNumber()) return; + if (!this.isCell()) return; JSC.C.JSValueProtect(JSC.VirtualMachine.get().global, this.asObjectRef()); } pub fn unprotect(this: JSValue) void { - if (this.isEmptyOrUndefinedOrNull() or this.isNumber()) return; + if (!this.isCell()) return; JSC.C.JSValueUnprotect(JSC.VirtualMachine.get().global, this.asObjectRef()); }