summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2017-01-06 19:26:25 +0000
committerRichard Hughes <richard@hughsie.com>2017-01-17 10:36:20 +0000
commitc921d4f87130be8cb331dcf635fa32a74404102d (patch)
tree5a4adb017fe4f1502fbc3015ba51c53988fb4a04
parent5c07fa0e432fc6218c6e673f86ecf0cd475b5e06 (diff)
downloadappstream-glib-c921d4f87130be8cb331dcf635fa32a74404102d.tar.gz
trivial: Fix a crash when doing validate-root on an app with no icon
-rw-r--r--client/as-util.c16
1 files 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: ",