[Commmon] Fixed passing a pkgid 63/282063/2 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.063348 accepted/tizen/7.0/unified/hotfix/20221116.104913 accepted/tizen/unified/20220928.020830 tizen_7.0_m2_release
authorPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Mon, 26 Sep 2022 08:11:05 +0000 (10:11 +0200)
committerPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Mon, 26 Sep 2022 13:32:24 +0000 (15:32 +0200)
[Verification] Works well with wrt service application.

Change-Id: Ib1cebe4d57c7fc1962b0a6f11baca95fbb979834

src/common/tools.cc

index 2e4d02a..74a6b2f 100644 (file)
@@ -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");
     }