From 402ee94addbf7b25474ee554158dc74ebd5b5e04 Mon Sep 17 00:00:00 2001 From: yaoyuan Date: Tue, 10 May 2022 15:54:01 +0800 Subject: [PATCH] =?UTF-8?q?Adapt=20to=20napi=20changes=20=E5=85=B3?= =?UTF-8?q?=E8=81=94Issue:=20I56QAX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yaoyuan Change-Id: I189693c3f82ef2db8f84f4816533c469ce906411 --- interfaces/plugin/vibrator/src/vibrator_napi_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/plugin/vibrator/src/vibrator_napi_utils.cpp b/interfaces/plugin/vibrator/src/vibrator_napi_utils.cpp index 7492199..29ac5a7 100644 --- a/interfaces/plugin/vibrator/src/vibrator_napi_utils.cpp +++ b/interfaces/plugin/vibrator/src/vibrator_napi_utils.cpp @@ -99,7 +99,7 @@ bool GetStringValue(const napi_env &env, const napi_value &value, string &result NAPI_CALL_BASE(env, napi_get_value_string_utf8(env, value, nullptr, 0, &bufLength), false); char str[STRING_LENGTH_MAX] = {0}; size_t strLen = 0; - NAPI_CALL_BASE(env, napi_get_value_string_utf8(env, value, str, bufLength, &strLen), false); + NAPI_CALL_BASE(env, napi_get_value_string_utf8(env, value, str, bufLength + 1, &strLen), false); result = str; return true; } @@ -244,4 +244,4 @@ void EmitPromiseWork(sptr asyncCallbackInfo) } } } // namespace Sensors -} // namespace OHOS \ No newline at end of file +} // namespace OHOS -- Gitee