From: Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics Date: Mon, 26 Sep 2022 08:11:05 +0000 (+0200) Subject: [Commmon] Fixed passing a pkgid X-Git-Tag: accepted/tizen/unified/20220928.020830^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb51f0fb4ad46e899f47342947f23d3ec8cae794;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Commmon] Fixed passing a pkgid [Verification] Works well with wrt service application. Change-Id: Ib1cebe4d57c7fc1962b0a6f11baca95fbb979834 --- diff --git a/src/common/tools.cc b/src/common/tools.cc index 2e4d02a3..74a6b2fd 100644 --- a/src/common/tools.cc +++ b/src/common/tools.cc @@ -435,12 +435,12 @@ PlatformResult GetPkgApiVersion(std::string* api_version) { 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"); }