[gnome-software: 1/9] snap: Fix crash if finding alternates returns an error




commit adf294cdd9fb03e912d5be037f161b845909e9ac
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Oct 15 13:45:36 2021 +0100

    snap: Fix crash if finding alternates returns an error
    
    This happens if snapd isn’t running.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 plugins/snap/gs-plugin-snap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 88bd4676e..bc483c8a0 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -737,7 +737,7 @@ gs_plugin_add_alternates (GsPlugin *plugin,
                guint i;
 
                snaps = find_snaps (self, SNAPD_FIND_FLAGS_SCOPE_WIDE | SNAPD_FIND_FLAGS_MATCH_COMMON_ID, 
NULL, gs_app_get_id (app), cancellable, NULL);
-               for (i = 0; i < snaps->len; i++) {
+               for (i = 0; snaps != NULL && i < snaps->len; i++) {
                        SnapdSnap *snap = g_ptr_array_index (snaps, i);
                        SnapdSnap *store_snap;
 


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