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 <lihucheng2@huawei.com>
This commit is contained in:
hunili 2023-06-16 10:19:44 +08:00
parent ee29508a57
commit 5e92ff4eb3

View File

@ -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!");