Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -53214,7 +53214,8 @@ static JSArrayBuffer *js_get_array_buffer(JSContext *ctx, JSValueConst obj)
}

/* return NULL if exception. WARNING: any JS call can detach the
buffer and render the returned pointer invalid */
buffer and render the returned pointer invalid. psize can be
NULL. */
uint8_t *JS_GetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst obj)
{
JSArrayBuffer *abuf = js_get_array_buffer(ctx, obj);
Expand All @@ -53224,10 +53225,14 @@ uint8_t *JS_GetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst obj)
JS_ThrowTypeErrorDetachedArrayBuffer(ctx);
goto fail;
}
*psize = abuf->byte_length;
if (psize) {
*psize = abuf->byte_length;
}
return abuf->data;
fail:
*psize = 0;
if (psize) {
*psize = 0;
}
return NULL;
}

Expand Down