Fix a bug about setting main components 36/213636/1
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 9 Sep 2019 10:10:12 +0000 (19:10 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 9 Sep 2019 10:10:12 +0000 (19:10 +0900)
Change-Id: I397126595b014c30ddb0da35984ed256a381b0a2
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
parser/component/src/component_plugin_parser_handler.c

index bc18e82..728f8c9 100644 (file)
@@ -847,6 +847,7 @@ static int __insert_component_info(GList *components)
 int component_plugin_parser_handler_install(const char *package, xmlDocPtr doc)
 {
        GList *list = NULL;
+       GList *tmp = NULL;
        const char *name;
        xmlNode *root;
        xmlNode *node;
@@ -873,12 +874,22 @@ int component_plugin_parser_handler_install(const char *package, xmlDocPtr doc)
                if (strcmp(name, "component-based-application") != 0)
                        continue;
 
-               ret = __parse_component_based_application(package, node, &list);
+               ret = __parse_component_based_application(package, node, &tmp);
                if (ret < 0) {
                        LOGE("Failed to parse component-based-application");
                        g_list_free_full(list, __destroy_component);
                        return -1;
                }
+
+               if (!tmp) {
+                       LOGE("Component info is empty");
+                       g_list_free_full(list, __destroy_component);
+                       return -1;
+               }
+
+               __fill_extra_info(tmp);
+               list = g_list_concat(list, tmp);
+               tmp = NULL;
        }
 
        if (!list) {
@@ -886,8 +897,7 @@ int component_plugin_parser_handler_install(const char *package, xmlDocPtr doc)
                return -1;
        }
 
-       __fill_extra_info(g_list_first(list));
-       ret = __insert_component_info(g_list_first(list));
+       ret = __insert_component_info(list);
        g_list_free_full(list, __destroy_component);
 
        return ret;