[gnome-software] snap: Don't try to get alternatives for non-snaps



commit 8a9850e87dea6bb57942a069d08624fd258acbc9
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Nov 28 12:58:11 2019 +1300

    snap: Don't try to get alternatives for non-snaps
    
    That's likely to crash...

 plugins/snap/gs-plugin-snap.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 11634b52..c6163bf5 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -589,6 +589,10 @@ gs_plugin_add_alternates (GsPlugin *plugin,
        GPtrArray *channels;
        g_autoptr(GPtrArray) sorted_channels = NULL;
 
+       /* not us */
+       if (g_strcmp0 (gs_app_get_management_plugin (app), "snap") != 0)
+               return TRUE;
+
        snap = get_store_snap (plugin, gs_app_get_metadata_item (app, "snap::name"), TRUE, cancellable, NULL);
        if (snap == NULL) {
                g_warning ("Failed to get store snap %s\n", gs_app_get_metadata_item (app, "snap::name"));


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