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



commit 717c8c231394bee3df5e6526d5a957d5a774b1e5
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 246db46..baf2a22 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -555,7 +555,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);
        }
        if (priv->history->len > 0)
                gs_app_kv_printf (str, "history", "%u", priv->history->len);


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