From 48025962e943ac2f4801cf6c1b448f436cacd8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=AB=8B?= Date: Sat, 13 Sep 2025 16:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨立 --- .../js/src/mod_fs/class_tasksignal/task_signal_entity.cpp | 4 ++-- interfaces/kits/js/src/mod_fs/properties/connectdfs.cpp | 6 +++--- interfaces/kits/js/src/mod_fs/properties/copy.cpp | 2 +- .../src/mod_fs/properties/copy_listener/trans_listener.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/class_tasksignal/task_signal_entity.cpp b/interfaces/kits/js/src/mod_fs/class_tasksignal/task_signal_entity.cpp index 99fee553d..75cd20a27 100644 --- a/interfaces/kits/js/src/mod_fs/class_tasksignal/task_signal_entity.cpp +++ b/interfaces/kits/js/src/mod_fs/class_tasksignal/task_signal_entity.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,7 +33,7 @@ void TaskSignalEntity::OnCancel() } napi_handle_scope scope = nullptr; napi_status ret = napi_open_handle_scope(callbackContext->env_, &scope); - if (ret != napi_ok) { + if (ret != napi_ok || scope == nullptr) { return; } napi_env env = callbackContext->env_; diff --git a/interfaces/kits/js/src/mod_fs/properties/connectdfs.cpp b/interfaces/kits/js/src/mod_fs/properties/connectdfs.cpp index 380ba3502..c27c2c436 100644 --- a/interfaces/kits/js/src/mod_fs/properties/connectdfs.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/connectdfs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -196,8 +196,8 @@ ConnectDfsCB *CheckAndGetParameters(ConnectDfsCB *connectDfsCB, napi_handle_scop HILOGE("ConnectDfsCB, GetParam connectDfsCB is null"); return nullptr; } - napi_open_handle_scope(connectDfsCB->cbBase.cbInfo.env, scope); - if (scope == nullptr) { + napi_status ret = napi_open_handle_scope(connectDfsCB->cbBase.cbInfo.env, scope); + if (ret != napi_ok || scope == nullptr) { delete connectDfsCB; connectDfsCB = nullptr; return nullptr; diff --git a/interfaces/kits/js/src/mod_fs/properties/copy.cpp b/interfaces/kits/js/src/mod_fs/properties/copy.cpp index b800d5bc1..6ab78816b 100644 --- a/interfaces/kits/js/src/mod_fs/properties/copy.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/copy.cpp @@ -183,7 +183,7 @@ void Copy::ReceiveComplete(std::shared_ptr entry) napi_handle_scope scope = nullptr; napi_env env = entry->callback->env; napi_status status = napi_open_handle_scope(env, &scope); - if (status != napi_ok) { + if (status != napi_ok || scope == nullptr) { HILOGE("Failed to open handle scope, status: %{public}d.", status); return; } diff --git a/interfaces/kits/js/src/mod_fs/properties/copy_listener/trans_listener.cpp b/interfaces/kits/js/src/mod_fs/properties/copy_listener/trans_listener.cpp index e83fb497e..4115a4e24 100644 --- a/interfaces/kits/js/src/mod_fs/properties/copy_listener/trans_listener.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/copy_listener/trans_listener.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -260,7 +260,7 @@ void TransListener::CallbackComplete(std::shared_ptr entry) napi_handle_scope scope = nullptr; napi_env env = entry->callback->env; napi_status status = napi_open_handle_scope(env, &scope); - if (status != napi_ok) { + if (status != napi_ok || scope == nullptr) { HILOGE("Failed to open handle scope, status: %{public}d.", status); return; } -- Gitee