[gnome-software] Fix critical warnings when clicking on an OS Update item



commit 3e72c38789428c57a54807f54e60ffb5d31aa3f3
Author: Kalev Lember <klember redhat com>
Date:   Tue Jan 2 21:41:24 2018 +0100

    Fix critical warnings when clicking on an OS Update item
    
    This fixes critical warnings in gs_app_to_string() when debug printing
    OS Update related apps. If we are dealing with a related package that
    doesn't have a unique ID (not a desktop app), just debug print the
    package name.

 lib/gs-app.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index 1cf4ffb..d629cb7 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -563,7 +563,10 @@ gs_app_to_string_append (GsApp *app, GString *str)
                                  gs_price_get_amount (priv->price));
        for (i = 0; i < priv->related->len; i++) {
                GsApp *app_tmp = g_ptr_array_index (priv->related, i);
-               gs_app_kv_lpad (str, "related", gs_app_get_unique_id (app_tmp));
+               const gchar *id = gs_app_get_unique_id (app_tmp);
+               if (id == NULL)
+                       id = gs_app_get_source_default (app_tmp);
+               gs_app_kv_lpad (str, "related", id);
        }
        for (i = 0; i < priv->history->len; i++) {
                GsApp *app_tmp = g_ptr_array_index (priv->history, i);


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