Fix clean undo operation of tag plugin
[platform/core/appfw/app-installers.git] / src / common / plugins / tag_plugin.cc
index 7a24833..3fca08f 100644 (file)
@@ -105,12 +105,14 @@ bool TagPlugin::Run(xmlDocPtr doc_ptr, manifest_x* manifest,
        action_type != ActionType::Undo &&
        action_type != ActionType::Clean) ? action_type_ : action_type;
   std::string pre_function = GetFunctionName(ProcessType::Pre, type);
-  Exec(pre_function, &result, manifest->package);
-  if (result) {
-    LOG(ERROR) << "Function: " << pre_function << " of plugin "
-               << plugin_info_.path() << " failed";
-    xmlFreeDoc(plugin_doc_ptr);
-    return false;
+  if (!pre_function.empty()) {
+    Exec(pre_function, &result, manifest->package);
+    if (result) {
+      LOG(ERROR) << "Function: " << pre_function << " of plugin "
+                 << plugin_info_.path() << " failed";
+      xmlFreeDoc(plugin_doc_ptr);
+      return false;
+    }
   }
 
   std::string main_function = GetFunctionName(ProcessType::Main, type);
@@ -123,12 +125,14 @@ bool TagPlugin::Run(xmlDocPtr doc_ptr, manifest_x* manifest,
   }
 
   std::string post_function = GetFunctionName(ProcessType::Post, type);
-  Exec(post_function, &result, manifest->package);
-  if (result) {
-    LOG(ERROR) << "Function: " << post_function << " of plugin "
-               << plugin_info_.path() << " failed";
-    xmlFreeDoc(plugin_doc_ptr);
-    return false;
+  if (!post_function.empty()) {
+    Exec(post_function, &result, manifest->package);
+    if (result) {
+      LOG(ERROR) << "Function: " << post_function << " of plugin "
+                 << plugin_info_.path() << " failed";
+      xmlFreeDoc(plugin_doc_ptr);
+      return false;
+    }
   }
 
   xmlFreeDoc(plugin_doc_ptr);