Avoid referencing inexistant object to fix crash 38/51738/1
authorYoumin Ha <youmin.ha@samsung.com>
Fri, 13 Nov 2015 09:22:17 +0000 (18:22 +0900)
committerYoumin Ha <youmin.ha@samsung.com>
Fri, 13 Nov 2015 09:22:17 +0000 (18:22 +0900)
When installing an app having only service-applications, there is no
ui-application element in the manifest. In this case, current log
printing code causes crash at runtime.
This commit fixes the crash.

Change-Id: I2aac4bf1a4a38dad3422728eaa85cf05c90602a9
Signed-off-by: Youmin Ha <youmin.ha@samsung.com>
src/tpk/step/step_parse.cc

index 1317f8d..e29f949 100644 (file)
@@ -436,10 +436,12 @@ common_installer::Step::Status StepParse::process() {
   LOG(DEBUG) << "App package: " << info->package();
   LOG(DEBUG) << "  aplication version     = " <<  info->version();
   LOG(DEBUG) << "  api_version = " <<  info->api_version();
-  LOG(DEBUG) << "  launch_modes -[";
-  for (const auto& application : ui_application_list->items) {
-    LOG(DEBUG) << "    launch_mode[" << application.ui_info.appid() << "] = "
-               <<  application.ui_info.launch_mode();
+  if (ui_application_list) {
+    LOG(DEBUG) << "  launch_modes -[";
+    for (const auto& application : ui_application_list->items) {
+      LOG(DEBUG) << "    launch_mode[" << application.ui_info.appid() << "] = "
+        <<  application.ui_info.launch_mode();
+    }
   }
   LOG(DEBUG) << "  ]-";
   LOG(DEBUG) << "  privileges -[";