check null value of extra icon path. 82/74482/13 submit/tizen/20160809.011327
authorjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 14 Jun 2016 04:59:52 +0000 (13:59 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Mon, 8 Aug 2016 05:15:11 +0000 (22:15 -0700)
Change-Id: I5c281d023a9fd0ed7ba9483c6c9d604e0cf60ee0
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/common/step/backup/step_backup_icons.cc
src/common/step/filesystem/step_create_icons.cc
src/common/step/filesystem/step_recover_icons.cc
src/common/step/filesystem/step_remove_icons.cc

index 035b977..2bbaedf 100644 (file)
@@ -23,8 +23,12 @@ namespace backup {
 
 Step::Status StepBackupIcons::process() {
   // gather icon info
-  for (auto iter = bf::directory_iterator(getIconPath(context_->uid.get(),
-          context_->is_preload_request.get()));
+  const char* extra_icon_path = getIconPath(context_->uid.get(),
+      context_->is_preload_request.get());
+  if (!extra_icon_path)
+    return Status::OK;
+
+  for (auto iter = bf::directory_iterator(extra_icon_path);
       iter != bf::directory_iterator(); ++iter) {
     if (!bf::is_regular_file(iter->path()))
       continue;
index beddf6e..b01585e 100644 (file)
@@ -25,8 +25,12 @@ Step::Status StepCreateIcons::undo() {
 }
 
 Step::Status StepCreateIcons::process() {
-  bf::path destination =
-      getIconPath(context_->uid.get(), context_->is_preload_request.get());
+  const char* extra_icon_path = getIconPath(context_->uid.get(),
+      context_->is_preload_request.get());
+  if (!extra_icon_path)
+    return Status::OK;
+
+  bf::path destination = extra_icon_path;
   bs::error_code error;
   if (!bf::exists(destination)) {
     bf::create_directories(destination, error);
index f413313..30f86f7 100644 (file)
@@ -56,8 +56,11 @@ bool StepRecoverIcons::TryGatherIcons() {
     return false;
 
   // gather icon info
-  for (auto iter = bf::directory_iterator(getIconPath(context_->uid.get(),
-          context_->is_preload_request.get()));
+  const char* extra_icon_path = getIconPath(context_->uid.get(),
+      context_->is_preload_request.get());
+  if (!extra_icon_path)
+    return true;
+  for (auto iter = bf::directory_iterator(extra_icon_path);
       iter != bf::directory_iterator(); ++iter) {
     if (!bf::is_regular_file(iter->path()))
       continue;
index 5c77e7c..a907c92 100644 (file)
@@ -30,8 +30,11 @@ Step::Status StepRemoveIcons::precheck() {
 }
 
 Step::Status StepRemoveIcons::process() {
-  for (auto iter = bf::directory_iterator(getIconPath(context_->uid.get(),
-          context_->is_preload_request.get()));
+  const char* extra_icon_path = getIconPath(context_->uid.get(),
+      context_->is_preload_request.get());
+  if (!extra_icon_path)
+    return Status::OK;
+  for (auto iter = bf::directory_iterator(extra_icon_path);
       iter != bf::directory_iterator(); ++iter) {
     if (!bf::is_regular_file(iter->path()))
       continue;