diff options
author | Richard Hughes <richard@hughsie.com> | 2016-09-28 16:59:09 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2016-09-28 16:59:11 +0100 |
commit | f0990480624f7f76f6d82a4d1d7356464e340880 (patch) | |
tree | 9d0567e8f4367d2d0b007ee359b2a0fe929565fe | |
parent | 6f397ae28f2fca8a8ad3dc2fdbb968fd39f70f77 (diff) | |
download | appstream-glib-f0990480624f7f76f6d82a4d1d7356464e340880.tar.gz |
Don't show a critical warning on invalid yaml file
This is surely invalid, but we should do better than a critical:
Categories:
- ''
-rw-r--r-- | libappstream-glib/as-app.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index 4eeacf6..a44bd9f 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -4880,6 +4880,7 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node, GNode *c; GNode *c2; GNode *n; + const gchar *nonfatal_str = NULL; const gchar *tmp; for (n = node->children; n != NULL; n = n->next) { @@ -4936,8 +4937,14 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node, continue; } if (g_strcmp0 (tmp, "Categories") == 0) { - for (c = n->children; c != NULL; c = c->next) - as_app_add_category (app, as_yaml_node_get_key (c)); + for (c = n->children; c != NULL; c = c->next) { + tmp = as_yaml_node_get_key (c); + if (tmp == NULL) { + nonfatal_str = "contained empty category"; + continue; + } + as_app_add_category (app, tmp); + } continue; } if (g_strcmp0 (tmp, "Icon") == 0) { @@ -5058,6 +5065,10 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node, continue; } } + if (nonfatal_str != NULL) { + g_debug ("nonfatal warning from %s: %s", + as_app_get_id (app), nonfatal_str); + } return TRUE; } |