[gnome-software] fwupd: Prevent a warning due to a bug in old versions of fwupd



commit 53a43dd0ef37e5adde20e539a5015dcbdceddb7d
Author: Richard Hughes <richard hughsie com>
Date:   Mon Feb 19 14:09:34 2018 +0000

    fwupd: Prevent a warning due to a bug in old versions of fwupd
    
    The 'old' references the date the history item was committed to the fwupd
    history database, not the include or link-time version.

 plugins/fwupd/gs-plugin-fwupd.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
index 491634d5..3f205c4a 100644
--- a/plugins/fwupd/gs-plugin-fwupd.c
+++ b/plugins/fwupd/gs-plugin-fwupd.c
@@ -287,6 +287,10 @@ gs_plugin_fwupd_new_app_from_device (GsPlugin *plugin, FwupdDevice *dev)
        g_autofree gchar *id = NULL;
        g_autoptr(AsIcon) icon = NULL;
 
+       /* older versions of fwups didn't record this for historical devices */
+       if (fwupd_release_get_appstream_id (rel) == NULL)
+               return NULL;
+
        /* get from cache */
        id = as_utils_unique_id_build (AS_APP_SCOPE_SYSTEM,
                                       AS_BUNDLE_KIND_UNKNOWN,
@@ -533,6 +537,14 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
 
        /* parse */
        app = gs_plugin_fwupd_new_app_from_device (plugin, dev);
+       if (app == NULL) {
+               g_set_error (error,
+                            GS_PLUGIN_ERROR,
+                            GS_PLUGIN_ERROR_FAILED,
+                            "failed to build result for %s",
+                            fwupd_device_get_id (dev));
+               return FALSE;
+       }
        gs_app_list_add (list, app);
        return TRUE;
 }


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