mirror of
https://github.com/bellard/quickjs.git
synced 2026-05-27 19:09:36 +00:00
Merge 83fa0503121a1363bc3586fe02cb31115b54f06f into d73189dd5a582c19c565774bd56fed4e72d33c99
This commit is contained in:
commit
6ca975a6dc
11
quickjs.c
11
quickjs.c
@ -56783,7 +56783,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);
|
||||
@ -56793,10 +56794,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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user