From b11db87ad3564ce2dd786c8902458569ad5b64e4 Mon Sep 17 00:00:00 2001 From: southorange0929 Date: Sun, 1 Dec 2024 11:02:15 +0800 Subject: [PATCH] Check napi callee status --- .gitignore | 1 + include/napi-inl.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2514623..1db7737 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build/ .idea/ +.vscode cmake-build-debug/ diff --git a/include/napi-inl.h b/include/napi-inl.h index 4dc2e48..52736ae 100644 --- a/include/napi-inl.h +++ b/include/napi-inl.h @@ -2853,7 +2853,8 @@ inline void ArrayBuffer::Detach() { inline T* Buffer::Data() const { void *data = nullptr; size_t length = 0; - napi_get_buffer_info(_env, _value, &data, &length); + napi_status status = napi_get_buffer_info(_env, _value, &data, &length); + NAPI_THROW_IF_FAILED(_env, status, Buffer()); return reinterpret_cast(data); }