From d97997da94968bcccfd7b45f17d20b30728fd3f0 Mon Sep 17 00:00:00 2001 From: suozhipeng Date: Sat, 30 Nov 2024 16:21:13 +0800 Subject: [PATCH] fix: null_bug Signed-off-by: suozhipeng --- frameworks/napi/power/power.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frameworks/napi/power/power.cpp b/frameworks/napi/power/power.cpp index 8dcc450f..46d9213e 100644 --- a/frameworks/napi/power/power.cpp +++ b/frameworks/napi/power/power.cpp @@ -77,7 +77,7 @@ void Power::IsScreenOnCallBack(napi_env env, std::unique_ptr(data); @@ -102,7 +102,8 @@ void Power::IsScreenOnCallBack(napi_env env, std::unique_ptr(asCallbackInfoPtr.get()), &asCallbackInfoPtr->asyncWork); - if (napi_ok == napi_queue_async_work_with_qos(env, asCallbackInfoPtr->asyncWork, napi_qos_utility)) { + if (napi_ok == napi_queue_async_work_with_qos(env, asCallbackInfoPtr->asyncWork, napi_qos_utility) + && ret == napi_ok) { asCallbackInfoPtr.release(); } } -- Gitee