[gnome-software/gnome-3-14] Do not fail to get popular apps if the AppStream data is invalid
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-14] Do not fail to get popular apps if the AppStream data is invalid
- Date: Mon, 10 Nov 2014 16:03:40 +0000 (UTC)
commit 29ff3b65acbe8ea0fd360711009790e1fe309f2d
Author: Richard Hughes <richard hughsie com>
Date: Wed Oct 29 17:09:42 2014 +0000
Do not fail to get popular apps if the AppStream data is invalid
One bad application in the YAML file shouldn't stop the rest from working.
src/plugins/gs-plugin-appstream.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 69c40b9..4f6f2d4 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -713,6 +713,7 @@ gs_plugin_refine_item (GsPlugin *plugin,
if (tmp != NULL) {
from_xml = as_markup_convert_simple (tmp, -1, error);
if (from_xml == NULL) {
+ g_prefix_error (error, "trying to parse '%s': ", tmp);
ret = FALSE;
goto out;
}
@@ -1264,9 +1265,9 @@ gs_plugin_add_popular_from_category (GsPlugin *plugin,
GError **error)
{
AsApp *item;
+ GError *error_local = NULL;
GPtrArray *array;
GsApp *app;
- gboolean ret = TRUE;
guint i;
/* search categories for the search term */
@@ -1296,9 +1297,14 @@ gs_plugin_add_popular_from_category (GsPlugin *plugin,
/* add application */
app = gs_app_new (as_app_get_id_full (item));
- ret = gs_plugin_refine_item (plugin, app, item, error);
- if (!ret)
- goto out;
+ if (!gs_plugin_refine_item (plugin, app, item, &error_local)) {
+ g_warning ("Failed to refine %s: %s",
+ as_app_get_id (item),
+ error_local->message);
+ g_clear_error (&error_local);
+ g_object_unref (app);
+ continue;
+ }
/* only suggest awesome applications */
if (gs_plugin_appstream_is_app_awesome (app)) {
@@ -1311,8 +1317,7 @@ gs_plugin_add_popular_from_category (GsPlugin *plugin,
}
g_object_unref (app);
}
-out:
- return ret;
+ return TRUE;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]