[gnome-software/gnome-3-22] packagekit: Don't crash when source_ids aren't set



commit b2c1429f7edbe581b7cadfa4ba71ab21abe2eddb
Author: Kalev Lember <klember redhat com>
Date:   Sun Jan 1 19:05:16 2017 +0100

    packagekit: Don't crash when source_ids aren't set
    
    The root cause for this still needs investigating, but at the very least
    we can try to be prudent here and not crash.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1400733

 src/plugins/gs-plugin-packagekit.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 0e9d68b..b47e68f 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -275,6 +275,13 @@ gs_plugin_app_install (GsPlugin *plugin,
 
                /* get everything up front we need */
                source_ids = gs_app_get_source_ids (app);
+               if (source_ids->len == 0) {
+                       g_set_error_literal (error,
+                                            GS_PLUGIN_ERROR,
+                                            GS_PLUGIN_ERROR_NOT_SUPPORTED,
+                                            "installing not available");
+                       return FALSE;
+               }
                package_ids = g_new0 (gchar *, 2);
                package_ids[0] = g_strdup (g_ptr_array_index (source_ids, 0));
 


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