From e3b363163422132d650430f32d2efcd1f2af9155 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 14 Mar 2022 23:37:08 -0700 Subject: [PATCH] Handle segfault when console.log'ing stuff that should never make it to console.log in the first place --- src/javascript/jsc/bindings/exports.zig | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/javascript/jsc/bindings/exports.zig b/src/javascript/jsc/bindings/exports.zig index eefc450223..85ae5ac9e7 100644 --- a/src/javascript/jsc/bindings/exports.zig +++ b/src/javascript/jsc/bindings/exports.zig @@ -1231,6 +1231,15 @@ pub const ZigConsoleClient = struct { .cell = js_type, }; + // Cell is the "unknown" type + // if we call JSObjectGetPrivate, it can segfault + if (js_type == .Cell) { + return .{ + .tag = .NativeCode, + .cell = js_type, + }; + } + if (CAPI.JSObjectGetPrivate(value.asObjectRef()) != null) return .{ .tag = .Private,