diff --git a/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp b/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp index 31107e981e814871f5c8240f6b66c397d7e4ae47..87a6c77e7aca126b1bf74ab4b6e6f4c5dd8b128c 100644 --- a/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp +++ b/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp @@ -70,6 +70,11 @@ bool DeviceManagerImpl::isSystemAppCalling(void) LOGI("get bundle manager proxy success."); sptr iBundleMgr = iface_cast(remoteObject); + if (iBundleMgr == nullptr) { + LOGI("iBundleMgr is nullptr, caller may be a process"); + return true; + } + return iBundleMgr->CheckIsSystemAppByUid(uid); }