diff --git a/src/node_jsrtapi.cc b/src/node_jsrtapi.cc index a2b8650578..bc69aeb2a7 100644 --- a/src/node_jsrtapi.cc +++ b/src/node_jsrtapi.cc @@ -1358,6 +1358,12 @@ napi_status napi_create_buffer_copy(napi_env e, napi_status napi_is_buffer(napi_env e, napi_value v, bool* result) { CHECK_ARG(result); JsValueRef typedArray = reinterpret_cast(v); + JsValueType objectType; + CHECK_JSRT(JsGetValueType(typedArray, &objectType)); + if (objectType != JsTypedArray) { + *result = false; + return napi_ok; + } JsTypedArrayType arrayType; CHECK_JSRT(JsGetTypedArrayInfo(typedArray, &arrayType, nullptr, nullptr, nullptr)); *result = (arrayType == JsArrayTypeUint8);