Handle segfault when console.log'ing stuff that should never make it to console.log in the first place

This commit is contained in:
Jarred Sumner
2022-03-14 23:37:08 -07:00
parent 7b8113c7c7
commit e3b3631634

View File

@@ -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,