mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-12-19 07:58:03 +00:00
IssueNo:I5IU0E
Description:check nullptr before used. Sig:SIG_ApplicationFramework Feature or BugFix: BugFix Binary Source: No Signed-off-by: zhangyafei.echo <zhangyafei12@huawei.com> Change-Id: I9b3d81538d52dab36317f2da113bf69fca447831
This commit is contained in:
parent
828958b0b7
commit
eb465a84c4
@ -1491,6 +1491,7 @@ int AbilityManagerService::ConnectRemoteAbility(const Want &want, const sptr<IRe
|
||||
int AbilityManagerService::DisconnectLocalAbility(const sptr<IAbilityConnection> &connect)
|
||||
{
|
||||
HILOG_INFO("Disconnect local ability begin.");
|
||||
CHECK_POINTER_AND_RETURN(connectManager_, ERR_NO_INIT);
|
||||
return connectManager_->DisconnectAbilityLocked(connect);
|
||||
}
|
||||
|
||||
@ -1634,6 +1635,7 @@ int AbilityManagerService::UnRegisterMissionListener(const std::string &deviceId
|
||||
|
||||
void AbilityManagerService::RemoveAllServiceRecord()
|
||||
{
|
||||
CHECK_POINTER_LOG(connectManager_, "Connect manager not init.");
|
||||
connectManager_->RemoveAll();
|
||||
}
|
||||
|
||||
@ -2026,12 +2028,21 @@ bool AbilityManagerService::IsAbilityControllerStartById(int32_t missionId)
|
||||
|
||||
std::shared_ptr<AbilityRecord> AbilityManagerService::GetServiceRecordByElementName(const std::string &element)
|
||||
{
|
||||
if (!connectManager_) {
|
||||
HILOG_ERROR("Connect manager is nullptr.");
|
||||
return nullptr;
|
||||
}
|
||||
return connectManager_->GetServiceRecordByElementName(element);
|
||||
}
|
||||
|
||||
std::list<std::shared_ptr<ConnectionRecord>> AbilityManagerService::GetConnectRecordListByCallback(
|
||||
sptr<IAbilityConnection> callback)
|
||||
{
|
||||
if (!connectManager_) {
|
||||
HILOG_ERROR("Connect manager is nullptr.");
|
||||
std::list<std::shared_ptr<ConnectionRecord>> connectList;
|
||||
return connectList;
|
||||
}
|
||||
return connectManager_->GetConnectRecordListByCallback(callback);
|
||||
}
|
||||
|
||||
@ -2465,6 +2476,7 @@ void AbilityManagerService::DumpMissionInfosInner(const std::string &args, std::
|
||||
|
||||
void AbilityManagerService::DumpMissionInner(const std::string &args, std::vector<std::string> &info)
|
||||
{
|
||||
CHECK_POINTER_LOG(currentMissionListManager_, "Current mission manager not init.");
|
||||
std::vector<std::string> argList;
|
||||
SplitStr(args, " ", argList);
|
||||
if (argList.empty()) {
|
||||
@ -2481,6 +2493,7 @@ void AbilityManagerService::DumpMissionInner(const std::string &args, std::vecto
|
||||
|
||||
void AbilityManagerService::DumpStateInner(const std::string &args, std::vector<std::string> &info)
|
||||
{
|
||||
CHECK_POINTER_LOG(connectManager_, "Current mission manager not init.");
|
||||
std::vector<std::string> argList;
|
||||
SplitStr(args, " ", argList);
|
||||
if (argList.empty()) {
|
||||
@ -2748,6 +2761,8 @@ void AbilityManagerService::OnAbilityRequestDone(const sptr<IRemoteObject> &toke
|
||||
void AbilityManagerService::OnAppStateChanged(const AppInfo &info)
|
||||
{
|
||||
HILOG_INFO("On app state changed.");
|
||||
CHECK_POINTER_LOG(connectManager_, "Connect manager not init.");
|
||||
CHECK_POINTER_LOG(currentMissionListManager_, "Current mission list manager not init.");
|
||||
connectManager_->OnAppStateChanged(info);
|
||||
currentMissionListManager_->OnAppStateChanged(info);
|
||||
dataAbilityManager_->OnAppStateChanged(info);
|
||||
@ -3663,6 +3678,7 @@ int AbilityManagerService::ReleaseAbility(
|
||||
|
||||
CHECK_POINTER_AND_RETURN(connect, ERR_INVALID_VALUE);
|
||||
CHECK_POINTER_AND_RETURN(connect->AsObject(), ERR_INVALID_VALUE);
|
||||
CHECK_POINTER_AND_RETURN(currentMissionListManager_, ERR_NO_INIT);
|
||||
|
||||
std::string elementName = element.GetURI();
|
||||
HILOG_DEBUG("try to release called ability, name: %{public}s.", elementName.c_str());
|
||||
@ -4606,6 +4622,7 @@ int AbilityManagerService::BlockAmsService()
|
||||
int AbilityManagerService::BlockAbility(int32_t abilityRecordId)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s", __func__);
|
||||
CHECK_POINTER_AND_RETURN(currentMissionListManager_, ERR_NO_INIT);
|
||||
return currentMissionListManager_->BlockAbility(abilityRecordId);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user