From 214ab2b683d79e6dcbd8b465c03886a5ff697616 Mon Sep 17 00:00:00 2001 From: zhushuanghong Date: Fri, 6 Jun 2025 17:27:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A7=A3=E6=9E=90json?= =?UTF-8?q?=E5=88=A4=E7=A9=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhushuanghong --- services/native/src/work_scheduler_service.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index 22766e7..8b8ba98 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -226,6 +226,10 @@ list> WorkSchedulerService::ReadPersistedWorks() if (!GetJsonFromFile(PERSISTED_FILE_PATH, root)) { return workInfos; } + if (root.empty() || !root.isObject()) { + WS_HILOGE("ReadPersistedWorks failed, root is empty or not an object"); + return; + } for (const auto &it : root.getMemberNames()) { Json::Value workJson = root[it]; shared_ptr workInfo = make_shared(); -- Gitee From 148ee494f6283179c97b91dd96b175f4cb8f2fa3 Mon Sep 17 00:00:00 2001 From: zhushuanghong Date: Fri, 6 Jun 2025 17:28:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A7=A3=E6=9E=90json?= =?UTF-8?q?=E5=88=A4=E7=A9=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhushuanghong --- services/native/src/work_scheduler_service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index 8b8ba98..46af930 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -228,7 +228,7 @@ list> WorkSchedulerService::ReadPersistedWorks() } if (root.empty() || !root.isObject()) { WS_HILOGE("ReadPersistedWorks failed, root is empty or not an object"); - return; + return workInfos; } for (const auto &it : root.getMemberNames()) { Json::Value workJson = root[it]; -- Gitee