From 5e92ff4eb36daa58089f4d9bf3ced8ff1caf6b59 Mon Sep 17 00:00:00 2001 From: hunili Date: Fri, 16 Jun 2023 10:19:44 +0800 Subject: [PATCH] Fix the bug input error deviceId no catch error 1. Add conditional filtering issue:https://gitee.com/openharmony/ability_dmsfwk/issues/I7DLAP Signed-off-by: hunili --- .../dtbschedmgr/src/distributed_sched_service.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/dtbschedmgr/src/distributed_sched_service.cpp b/services/dtbschedmgr/src/distributed_sched_service.cpp index 83b47e8f..db62ae18 100644 --- a/services/dtbschedmgr/src/distributed_sched_service.cpp +++ b/services/dtbschedmgr/src/distributed_sched_service.cpp @@ -447,9 +447,11 @@ int32_t DistributedSchedService::ContinueMission(const std::string& srcDeviceId, return INVALID_PARAMETERS_ERR; } - if (srcDeviceId == localDevId) { + if (srcDeviceId == localDevId && + DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(dstDeviceId) != nullptr) { return ContinueLocalMission(dstDeviceId, missionId, callback, wantParams); - } else if (dstDeviceId == localDevId) { + } else if (dstDeviceId == localDevId && + DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(srcDeviceId) != nullptr) { return ContinueRemoteMission(srcDeviceId, dstDeviceId, missionId, callback, wantParams); } else { HILOGE("source or target device must be local!"); @@ -473,7 +475,8 @@ int32_t DistributedSchedService::ContinueMission(const std::string& srcDeviceId, return INVALID_PARAMETERS_ERR; } - if (srcDeviceId == localDevId) { + if (srcDeviceId == localDevId && + DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(dstDeviceId) != nullptr) { int32_t missionId = 1; #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER int32_t ret = DistributedSchedContinueManager::GetInstance().GetMissionId(bundleName, missionId); @@ -483,7 +486,8 @@ int32_t DistributedSchedService::ContinueMission(const std::string& srcDeviceId, } #endif return ContinueLocalMission(dstDeviceId, missionId, callback, wantParams); - } else if (dstDeviceId == localDevId) { + } else if (dstDeviceId == localDevId && + DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(srcDeviceId) != nullptr) { return ContinueRemoteMission(srcDeviceId, dstDeviceId, bundleName, callback, wantParams); } else { HILOGE("source or target device must be local!");