Unnecessary queries if pkg_id is empty 69/123069/5
authorDamian Pietruchowski <d.pietruchow@samsung.com>
Tue, 4 Apr 2017 09:55:59 +0000 (11:55 +0200)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Tue, 18 Jul 2017 04:43:34 +0000 (04:43 +0000)
Change-Id: I825867e85142e704a50ecde510c4a8b72d97ae84
Signed-off-by: Damian Pietruchowski <d.pietruchow@samsung.com>
src/wgt/step/configuration/step_parse.cc

index 6157663..1844dec 100644 (file)
@@ -273,19 +273,24 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) {
     manifest->installlocation = strdup("auto");
   }
 
-  // set update true if package is updated preload package
-  ci::RequestType req_type = context_->request_type.get();
-  if (ci::QueryIsUpdatedPackage(context_->pkgid.get(), context_->uid.get()))
-    manifest->update = strdup("true");
-  else if (ci::QueryIsPreloadPackage(context_->pkgid.get(),
-      context_->uid.get()) &&
-          (req_type == ci::RequestType::Update ||
-           req_type == ci::RequestType::Delta ||
-           req_type == ci::RequestType::MountUpdate ||
-           req_type == ci::RequestType::ReadonlyUpdateInstall))
-    manifest->update = strdup("true");
-  else
+  if (!context_->pkgid.get().empty()) {
+    // set update true if package is updated preload package
+    ci::RequestType req_type = context_->request_type.get();
+    if (ci::QueryIsUpdatedPackage(context_->pkgid.get(), context_->uid.get()))
+      manifest->update = strdup("true");
+    else if (ci::QueryIsPreloadPackage(context_->pkgid.get(),
+        context_->uid.get()) &&
+            (req_type == ci::RequestType::Update ||
+             req_type == ci::RequestType::Delta ||
+             req_type == ci::RequestType::MountUpdate ||
+             req_type == ci::RequestType::ReadonlyUpdateInstall))
+      manifest->update = strdup("true");
+    else
+      manifest->update = strdup("false");
+  }
+  else {
     manifest->update = strdup("false");
+  }
 
   return true;
 }