[gnome-software/gnome-42: 2/4] gs-appstream: Fix getting apps for categories if first group is empty




commit 079193f783f32a70d0910b5f33ba7c015aaffce6
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed May 25 12:04:23 2022 +0100

    gs-appstream: Fix getting apps for categories if first group is empty
    
    Categories in gnome-software each comprise one or more XDG standardised
    desktop groups, and are the union of all the apps in those groups.
    
    Previously, the code in `gs_appstream_add_category_apps()` would
    incorrectly return if any of the queries for apps in a particular
    desktop group returned no results. This meant the remaining groups in
    the category would not be checked.
    
    Fix that by continuing on to the next group if a query returns no
    results.
    
    Spotted by code inspection.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-appstream.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index cb07cab9b..4b8894927 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -1486,7 +1486,6 @@ gs_appstream_add_category_apps (GsPlugin *plugin,
                                GError **error)
 {
        GPtrArray *desktop_groups;
-       g_autoptr(GError) error_local = NULL;
 
        desktop_groups = gs_category_get_desktop_groups (category);
        if (desktop_groups->len == 0) {
@@ -1498,6 +1497,7 @@ gs_appstream_add_category_apps (GsPlugin *plugin,
                g_autofree gchar *xpath = NULL;
                g_auto(GStrv) split = g_strsplit (desktop_group, "::", -1);
                g_autoptr(GPtrArray) components = NULL;
+               g_autoptr(GError) error_local = NULL;
 
                /* generate query */
                if (g_strv_length (split) == 1) {
@@ -1513,7 +1513,7 @@ gs_appstream_add_category_apps (GsPlugin *plugin,
                components = xb_silo_query (silo, xpath, 0, &error_local);
                if (components == NULL) {
                        if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
-                               return TRUE;
+                               continue;
                        g_propagate_error (error, g_steal_pointer (&error_local));
                        return FALSE;
                }


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