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



commit c947ef0bd9f04b4e21bec8f8f233e42a7dde5b88
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 15806a3..460e41f 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -276,6 +276,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]