diff options
author | Richard Hughes <richard@hughsie.com> | 2017-01-06 19:26:25 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2017-01-08 10:54:34 +0000 |
commit | 7f83d8c652492e4626429d728bd195e1984e49a8 (patch) | |
tree | d11eb5eda233f3b9451f1f673830192c26bf8e60 | |
parent | d41dce8c4469e1a4b24a4c0bace3c11357d26948 (diff) | |
download | appstream-glib-7f83d8c652492e4626429d728bd195e1984e49a8.tar.gz |
trivial: Fix a crash when doing validate-root on an app with no icon
-rw-r--r-- | client/as-util.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/client/as-util.c b/client/as-util.c index 5c6d05a..78c3acd 100644 --- a/client/as-util.c +++ b/client/as-util.c @@ -2890,6 +2890,7 @@ static gboolean as_util_check_root_app_icon (AsApp *app, GError **error) { AsIcon *icon_default; + const gchar *name; g_autofree gchar *icon = NULL; g_autoptr(GdkPixbuf) pb = NULL; @@ -2922,9 +2923,18 @@ as_util_check_root_app_icon (AsApp *app, GError **error) return TRUE; /* can we find it */ - icon = as_utils_find_icon_filename (g_getenv ("DESTDIR"), - as_icon_get_name (icon_default), - error); + name = as_icon_get_name (icon_default); + if (name == NULL) + name = as_icon_get_filename (icon_default); + if (name == NULL) { + g_set_error (error, + AS_ERROR, + AS_ERROR_FAILED, + "%s has no icon set", + as_app_get_id (app)); + return FALSE; + } + icon = as_utils_find_icon_filename (g_getenv ("DESTDIR"), name, error); if (icon == NULL) { g_prefix_error (error, "%s missing icon %s: ", |