From cc11d729c067066e46939700a879faf7fae2df0d Mon Sep 17 00:00:00 2001 From: legendecas Date: Mon, 24 May 2021 01:04:24 +0800 Subject: [PATCH] src: set default return value of Reference Ref/Unref to 0 PR-URL: https://github.com/nodejs/node-addon-api/pull/1004 Reviewed-By: Michael Dawson --- napi-inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/napi-inl.h b/napi-inl.h index dd563a4dd..1f6563fea 100644 --- a/napi-inl.h +++ b/napi-inl.h @@ -2609,7 +2609,7 @@ template inline uint32_t Reference::Ref() { uint32_t result; napi_status status = napi_reference_ref(_env, _ref, &result); - NAPI_THROW_IF_FAILED(_env, status, 1); + NAPI_THROW_IF_FAILED(_env, status, 0); return result; } @@ -2617,7 +2617,7 @@ template inline uint32_t Reference::Unref() { uint32_t result; napi_status status = napi_reference_unref(_env, _ref, &result); - NAPI_THROW_IF_FAILED(_env, status, 1); + NAPI_THROW_IF_FAILED(_env, status, 0); return result; }