diff --git a/services/dtbschedmgr/src/distributedWant/distributed_want_params.cpp b/services/dtbschedmgr/src/distributedWant/distributed_want_params.cpp index df2c19cb..4f6295fe 100644 --- a/services/dtbschedmgr/src/distributedWant/distributed_want_params.cpp +++ b/services/dtbschedmgr/src/distributedWant/distributed_want_params.cpp @@ -116,6 +116,10 @@ DistributedUnsupportedData& DistributedUnsupportedData::operator=(DistributedUns std::string DistributedWantParams::GetStringByType(const sptr iIt, int typeId) { + if (iIt == nullptr) { + return ""; + } + if (typeId == VALUE_TYPE_BOOLEAN) { return static_cast(AAFwk::IBoolean::Query(iIt))->ToString(); } else if (typeId == VALUE_TYPE_BYTE) { @@ -314,6 +318,9 @@ sptr DistributedWantParams::GetInterfaceByType(int typeId, const std bool DistributedWantParams::CompareNumberInterface(const sptr iIt1, const sptr iIt2, int typeId) { + if (iIt1 == nullptr) { + return false; + } bool flag = false; switch (typeId) { case VALUE_TYPE_SHORT: @@ -344,6 +351,9 @@ bool DistributedWantParams::CompareNumberInterface(const sptr iIt1, bool DistributedWantParams::CompareInterface(const sptr iIt1, const sptr iIt2, int typeId) { + if (iIt1 == nullptr) { + return false; + } bool flag = false; switch (typeId) { case VALUE_TYPE_BOOLEAN: @@ -465,6 +475,9 @@ bool DistributedWantParams::WriteToParcelWantParams(Parcel& parcel, sptr(IDistributedWantParams::Query(o))->ToString())); } diff --git a/services/dtbschedmgr/src/distributed_sched_service.cpp b/services/dtbschedmgr/src/distributed_sched_service.cpp index 52f521fa..c656b3d2 100644 --- a/services/dtbschedmgr/src/distributed_sched_service.cpp +++ b/services/dtbschedmgr/src/distributed_sched_service.cpp @@ -1846,7 +1846,7 @@ void DistributedSchedService::ProcessCalleeOffline(const std::string& deviceId) } ReportDistributedComponentChange(callerInfo, DISTRIBUTED_COMPONENT_REMOVE, IDistributedSched::CALL, IDistributedSched::CALLER); - callerMap_.erase(iter++); + iter = callerMap_.erase(iter); } else { iter++; } @@ -2492,7 +2492,7 @@ int32_t DistributedSchedService::NotifyProcessDiedFromRemote(const CallerInfo& c } ReportDistributedComponentChange(connectInfo, DISTRIBUTED_COMPONENT_REMOVE, IDistributedSched::CONNECT, IDistributedSched::CALLEE); - connectAbilityMap_.erase(iter++); + iter = connectAbilityMap_.erase(iter); } else { iter++; } @@ -2525,7 +2525,7 @@ void DistributedSchedService::RemoveConnectAbilityInfo(const std::string& device DecreaseConnectLocked(uid); ReportDistributedComponentChange(callerInfo, DISTRIBUTED_COMPONENT_REMOVE, IDistributedSched::CONNECT, IDistributedSched::CALLER); - distributedConnectAbilityMap_.erase(iter++); + iter = distributedConnectAbilityMap_.erase(iter); } else { iter++; } @@ -2656,7 +2656,7 @@ void DistributedSchedService::ProcessConnectDied(const sptr& conn } ReportDistributedComponentChange(callerInfo, DISTRIBUTED_COMPONENT_REMOVE, IDistributedSched::CONNECT, IDistributedSched::CALLER); - distributedConnectAbilityMap_.erase(iter++); + iter = distributedConnectAbilityMap_.erase(iter); } else { iter++; } diff --git a/services/dtbschedmgr/src/distributed_sched_stub.cpp b/services/dtbschedmgr/src/distributed_sched_stub.cpp index 0d954e77..a916f269 100644 --- a/services/dtbschedmgr/src/distributed_sched_stub.cpp +++ b/services/dtbschedmgr/src/distributed_sched_stub.cpp @@ -1546,6 +1546,9 @@ int32_t DistributedSchedStub::StartFreeInstallFromRemoteInner(MessageParcel& dat info.want.RemoveParam(PARAM_FREEINSTALL_APPID); info.want.SetParam(PARAM_FREEINSTALL_APPID, callerInfo.callerAppId); info.want.RemoveParam(PARAM_FREEINSTALL_BUNDLENAMES); + if (cmpWant == nullptr) { + return ERR_NULL_OBJECT; + } info.want.SetParam( PARAM_FREEINSTALL_BUNDLENAMES, (*cmpWant).GetStringArrayParam(CMPT_PARAM_FREEINSTALL_BUNDLENAMES)); result = StartFreeInstallFromRemote(info, taskId); diff --git a/services/dtbschedmgr/src/dms_callback_task.cpp b/services/dtbschedmgr/src/dms_callback_task.cpp index 9a17d9bd..6b16e6f4 100644 --- a/services/dtbschedmgr/src/dms_callback_task.cpp +++ b/services/dtbschedmgr/src/dms_callback_task.cpp @@ -173,7 +173,7 @@ void DmsCallbackTask::NotifyDeviceOffline(const std::string& deviceId) dmsCallbackHandler_->RemoveEvent(it->second.taskId); } DistributedSchedService::GetInstance().NotifyFreeInstallResult(it->second, DEVICE_OFFLINE_ERR); - (void)callbackMap_.erase(it++); + it = callbackMap_.erase(it); } else { it++; }