diff options
Diffstat (limited to 'test/bun.js/ffi.test.fixture.receiver.c')
-rw-r--r-- | test/bun.js/ffi.test.fixture.receiver.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/bun.js/ffi.test.fixture.receiver.c b/test/bun.js/ffi.test.fixture.receiver.c index 6e1795919..3e2939a26 100644 --- a/test/bun.js/ffi.test.fixture.receiver.c +++ b/test/bun.js/ffi.test.fixture.receiver.c @@ -150,11 +150,17 @@ static bool JSVALUE_IS_NUMBER(EncodedJSValue val) { static void* JSVALUE_TO_PTR(EncodedJSValue val) { // must be a double + if (val.asInt64 == TagValueNull) + return 0; return (void*)(val.asInt64 - DoubleEncodeOffset); } static EncodedJSValue PTR_TO_JSVALUE(void* ptr) { EncodedJSValue val; + if (ptr == 0) { + val.asInt64 = TagValueNull; + return val; + } val.asInt64 = (int64_t)ptr + DoubleEncodeOffset; return val; } |