[gnome-software/gnome-3-26] fwupd: Fix critical warning if the update URI isn't set



commit 745e7cdd4602ce308fe8f58dd56ac7ed42efc9c2
Author: Richard Hughes <richard hughsie com>
Date:   Tue Sep 12 16:51:22 2017 +0100

    fwupd: Fix critical warning if the update URI isn't set

 plugins/fwupd/gs-fwupd-app.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/fwupd/gs-fwupd-app.c b/plugins/fwupd/gs-fwupd-app.c
index 3ed2697..19ead8e 100644
--- a/plugins/fwupd/gs-fwupd-app.c
+++ b/plugins/fwupd/gs-fwupd-app.c
@@ -49,10 +49,14 @@ static void
 gs_fwupd_app_to_string (GsApp *app, GString *str)
 {
        GsFwupdApp *fwupd_app = GS_FWUPD_APP (app);
-       gs_utils_append_key_value (str, 20, "fwupd::device-id",
-                                  fwupd_app->device_id);
-       gs_utils_append_key_value (str, 20, "fwupd::update-uri",
-                                  fwupd_app->update_uri);
+       if (fwupd_app->device_id != NULL) {
+               gs_utils_append_key_value (str, 20, "fwupd::device-id",
+                                          fwupd_app->device_id);
+       }
+       if (fwupd_app->update_uri != NULL) {
+               gs_utils_append_key_value (str, 20, "fwupd::update-uri",
+                                          fwupd_app->update_uri);
+       }
        gs_utils_append_key_value (str, 20, "fwupd::is-locked",
                                   fwupd_app->is_locked ? "yes" : "no");
 }


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