aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigGlobalObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index 923dc0010..12840aceb 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -1390,7 +1390,7 @@ extern "C" JSC__JSValue Bun__createArrayBufferForCopy(JSC::JSGlobalObject* globa
return JSC::JSValue::encode(JSC::JSValue {});
}
- if (len > 0)
+ if (len > 0 && ptr)
memcpy(arrayBuffer->data(), ptr, len);
RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTFMove(arrayBuffer))));
@@ -1409,7 +1409,7 @@ extern "C" JSC__JSValue Bun__createUint8ArrayForCopy(JSC::JSGlobalObject* global
return JSC::JSValue::encode(JSC::JSValue {});
}
- if (len > 0)
+ if (len > 0 && ptr)
memcpy(array->vector(), ptr, len);
RELEASE_AND_RETURN(scope, JSValue::encode(array));
@@ -4241,7 +4241,6 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
}
-
{
JSC::Identifier identifier = JSC::Identifier::fromString(vm, "BrotliCompressorSink"_s);
object->putDirectCustomAccessor(vm, identifier, JSC::CustomGetterSetter::create(vm, functionBrotliCompressorSink__getter, nullptr),