From 4d2c0f804715308d9db563300fac22e09a031ad3 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 7 Jul 2020 12:02:30 +0100 Subject: [PATCH] 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. --- libfwupdplugin/fu-common.c | 3 +++ src/fu-util-common.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/libfwupdplugin/fu-common.c b/libfwupdplugin/fu-common.c index 071a7e5a1..67ffd9098 100644 --- a/libfwupdplugin/fu-common.c +++ b/libfwupdplugin/fu-common.c @@ -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)) diff --git a/src/fu-util-common.c b/src/fu-util-common.c index 903d7ba06..961d305fd 100644 --- a/src/fu-util-common.c +++ b/src/fu-util-common.c @@ -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)) {