if (cached_pid == pid) {
*api_version = cached_api_version; // Retrieve from local cache
} else {
- const char *pkgid =common::CurrentApplication::GetInstance().GetPackageId().c_str();
- if (pkgid == nullptr) {
+ std::string pkgid =common::CurrentApplication::GetInstance().GetPackageId();
+ if (pkgid.empty()) {
return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Fail to get pkg id");
}
- int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, getuid(), &pkginfo_handle);
+ int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid.c_str(), getuid(), &pkginfo_handle);
if (ret != PMINFO_R_OK) {
return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Fail to get pkginfo_h");
}