From 98367761dda7a9d6b240fe943c85ff92da057981 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 9 Sep 2019 19:10:12 +0900 Subject: [PATCH] Fix a bug about setting main components Change-Id: I397126595b014c30ddb0da35984ed256a381b0a2 Signed-off-by: Hwankyu Jhun --- parser/component/src/component_plugin_parser_handler.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/parser/component/src/component_plugin_parser_handler.c b/parser/component/src/component_plugin_parser_handler.c index bc18e82..728f8c9 100644 --- a/parser/component/src/component_plugin_parser_handler.c +++ b/parser/component/src/component_plugin_parser_handler.c @@ -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; -- 2.7.4