From c921d4f87130be8cb331dcf635fa32a74404102d Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 6 Jan 2017 19:26:25 +0000 Subject: trivial: Fix a crash when doing validate-root on an app with no icon --- client/as-util.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/client/as-util.c b/client/as-util.c index 13c096c..b9c329a 100644 --- a/client/as-util.c +++ b/client/as-util.c @@ -2670,6 +2670,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; @@ -2702,9 +2703,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: ", -- cgit v1.2.1