mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 15:20:34 +00:00
!9666 cj_ability添加对ffidata的判空检查
Merge pull request !9666 from yuzhuohao/cj_ability_nullptr_check
This commit is contained in:
commit
ecc398a761
@ -78,6 +78,10 @@ int64_t FFIAbilityDelegatorRegistryGetAbilityDelegator()
|
||||
return INVALID_CODE;
|
||||
}
|
||||
auto cjDelegator = FFI::FFIData::Create<CJAbilityDelegator>(delegator);
|
||||
if (cjDelegator == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "cj delegator is null.");
|
||||
return INVALID_CODE;
|
||||
}
|
||||
return cjDelegator->GetID();
|
||||
}
|
||||
|
||||
@ -100,6 +104,10 @@ int32_t FFIAbilityDelegatorExecuteShellCommand(int64_t id, const char* cmd, int6
|
||||
return INVALID_CODE;
|
||||
}
|
||||
auto cJShellCmdResult = FFI::FFIData::Create<CJShellCmdResult>(cjDelegator->ExecuteShellCommand(cmd, timeoutSec));
|
||||
if (cJShellCmdResult == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "cj shell command result is null.");
|
||||
return INVALID_CODE;
|
||||
}
|
||||
return cJShellCmdResult->GetID();
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,10 @@ void CJAbilityConnectCallback::OnAbilityConnectDone(
|
||||
ElementNameHandle elementNameHandle = const_cast<AppExecFwk::ElementName*>(&element);
|
||||
// The cj side is responsible for the release.
|
||||
auto cjRemoteObj = FFI::FFIData::Create<AppExecFwk::CJRemoteObject>(remoteObject);
|
||||
if (cjRemoteObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "remote object is empty.");
|
||||
return;
|
||||
}
|
||||
g_cjAbilityConnectCallbackFuncs->onConnect(callbackId_, elementNameHandle, cjRemoteObj->GetID(), resultCode);
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,10 @@ int64_t FFIAbilityGetAbilityContext(AbilityHandle abilityHandle)
|
||||
return ERR_INVALID_INSTANCE_CODE;
|
||||
}
|
||||
auto cjContext = FFI::FFIData::Create<CJAbilityContext>(context);
|
||||
if (cjContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "GetAbilityContext failed, abilityContext is null");
|
||||
return ERR_INVALID_INSTANCE_CODE;
|
||||
}
|
||||
return cjContext->GetID();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user