trivial: Fix fwupdmgr get-history if the firmware was not installed from the LVFS

If you install a local .cab file that's not available on the LVFS then none
of the history for any devices is available.
This commit is contained in:
Richard Hughes 2019-11-01 12:07:53 +00:00 committed by Mario Limonciello
parent ec14e4bdd0
commit 9fcd29f92e

View File

@ -969,6 +969,7 @@ fu_util_get_history (FuUtilPrivate *priv, gchar **values, GError **error)
FwupdRelease *rel; FwupdRelease *rel;
const gchar *remote; const gchar *remote;
GNode *child; GNode *child;
g_autoptr(GError) error_local = NULL;
if (!fu_util_filter_device (priv, dev)) if (!fu_util_filter_device (priv, dev))
continue; continue;
@ -986,9 +987,16 @@ fu_util_get_history (FuUtilPrivate *priv, gchar **values, GError **error)
} }
/* try to lookup releases from client */ /* try to lookup releases from client */
rels = fwupd_client_get_releases (priv->client, fwupd_device_get_id (dev), NULL, error); rels = fwupd_client_get_releases (priv->client,
if (rels == NULL) fwupd_device_get_id (dev),
return FALSE; NULL, &error_local);
if (rels == NULL) {
g_debug ("failed to get releases for %s: %s",
fwupd_device_get_id (dev),
error_local->message);
g_node_append_data (child, rel);
continue;
}
/* map to a release in client */ /* map to a release in client */
for (guint j = 0; j < rels->len; j++) { for (guint j = 0; j < rels->len; j++) {