diff --git a/interfaces/kits/js/distributebundlemgr/distributed_bundle_mgr.cpp b/interfaces/kits/js/distributebundlemgr/distributed_bundle_mgr.cpp index 17915b063842c927591c86c9b9b94cb1b5e3f855..4d2315d0baa5792d08ae07c99d515bc79559f5d7 100644 --- a/interfaces/kits/js/distributebundlemgr/distributed_bundle_mgr.cpp +++ b/interfaces/kits/js/distributebundlemgr/distributed_bundle_mgr.cpp @@ -72,7 +72,10 @@ static OHOS::sptr GetDistributedBundleMgr() { APP_LOGI("GetDistributedBundleMgr"); auto samgr = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - // OHOS::sptr remoteObject; + if (samgr == nullptr) { + APP_LOGE("GetSystemAbilityManager failed, samgr is nullptr."); + return nullptr; + } auto remoteObject = samgr->GetSystemAbility(OHOS::DISTRIBUTED_BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); return OHOS::iface_cast(remoteObject); }