Skip to content

Commit ea46897

Browse files
authored
fix: failed to get ArrayBuffer data and size (#9)
1 parent 3a3d1b9 commit ea46897

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

include/napi-inl.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,15 +2166,16 @@ inline ArrayBuffer::ArrayBuffer(napi_env env, napi_value value)
21662166

21672167
inline void* ArrayBuffer::Data() {
21682168
void* data;
2169-
napi_status status = napi_get_arraybuffer_info(_env, _value, &data, nullptr);
2169+
size_t length;
2170+
napi_status status = napi_get_arraybuffer_info(_env, _value, &data, &length);
21702171
NAPI_THROW_IF_FAILED(_env, status, nullptr);
21712172
return data;
21722173
}
21732174

21742175
inline size_t ArrayBuffer::ByteLength() {
2176+
void* data;
21752177
size_t length;
2176-
napi_status status =
2177-
napi_get_arraybuffer_info(_env, _value, nullptr, &length);
2178+
napi_status status = napi_get_arraybuffer_info(_env, _value, &data, &length);
21782179
NAPI_THROW_IF_FAILED(_env, status, 0);
21792180
return length;
21802181
}

0 commit comments

Comments
 (0)