trivial: Fall back to the HSI ID if the name is not available

This fixes a crash if you 'ninja install' with a newer fwupd version and then
run fwupdtool from an older version.
This commit is contained in:
Richard Hughes 2020-07-07 12:02:30 +01:00
parent fb0a938f6c
commit 4d2c0f8047
2 changed files with 5 additions and 0 deletions

View File

@ -1240,6 +1240,9 @@ fu_common_strwidth (const gchar *text)
{
const gchar *p = text;
gsize width = 0;
g_return_val_if_fail (text != NULL, 0);
while (*p) {
gunichar c = g_utf8_get_char (p);
if (g_unichar_iswide (c))

View File

@ -1557,6 +1557,8 @@ static void
fu_security_attr_append_str (FwupdSecurityAttr *attr, GString *str)
{
g_autofree gchar *name = fu_security_attr_get_name (attr);
if (name == NULL)
name = g_strdup (fwupd_security_attr_get_appstream_id (attr));
if (fwupd_security_attr_has_flag (attr, FWUPD_SECURITY_ATTR_FLAG_OBSOLETED)) {
g_string_append (str, "");
} else if (fwupd_security_attr_has_flag (attr, FWUPD_SECURITY_ATTR_FLAG_SUCCESS)) {