[gnome-software/gnome-3-10] Do not abort if the AppStream XML is invalid



commit ead01d93153f745a3173fe50493b03afae008e70
Author: Richard Hughes <richard hughsie com>
Date:   Wed Oct 2 08:19:28 2013 +0100

    Do not abort if the AppStream XML is invalid
    
    This allows the application to continue is there is one bad file.

 src/plugins/gs-plugin-appstream.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 394de9f..4426d58 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -72,6 +72,7 @@ gs_plugin_parse_xml_file (GsPlugin *plugin,
                          const gchar *path_icons,
                          GError **error)
 {
+       GError *error_local = NULL;
        GFile *file = NULL;
        gboolean ret = FALSE;
        gchar *path_icons_full = NULL;
@@ -114,9 +115,19 @@ gs_plugin_parse_xml_file (GsPlugin *plugin,
                                          file,
                                          path_icons_full,
                                          NULL,
-                                         error);
-       if (!ret)
+                                         &error_local);
+       if (!ret) {
+               if (g_error_matches (error_local,
+                                    APPSTREAM_CACHE_ERROR,
+                                    APPSTREAM_CACHE_ERROR_FAILED)) {
+                       ret = TRUE;
+                       g_warning ("AppStream XML invalid: %s", error_local->message);
+                       g_error_free (error_local);
+               } else {
+                       g_propagate_error (error, error_local);
+               }
                goto out;
+       }
 out:
        g_free (path_icons_full);
        g_free (path_xml);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]