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



commit 166a010bafb407b27ec40feace9ba1b08d8c7d31
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 c9e84e4..b92aef0 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]