diff options
author | Justin J. Kim <justinjoy@users.noreply.github.com> | 2016-08-19 20:28:50 +0900 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2017-01-17 10:36:19 +0000 |
commit | 081ed63c055a0225370525a0a87958f83dd13f91 (patch) | |
tree | 9bf7349f07bf10d16f1483c23c9b91a0dc2755ef | |
parent | bc7f8f0f6bd90a2a4ecbbb22f7c97e877afb574b (diff) | |
download | appstream-glib-081ed63c055a0225370525a0a87958f83dd13f91.tar.gz |
as-app-validate: Check if icon_name is NULL (#130)
When 'as_icon_get_{file}name' return NULL, 'as_app_validate_icons' function
will show Critical Warning by calling 'g_str_has_prefix'. But it wouldn't be
a critical and sometimes, it could be NULL.
-rw-r--r-- | libappstream-glib/as-app-validate.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c index 75c289b..7602178 100644 --- a/libappstream-glib/as-app-validate.c +++ b/libappstream-glib/as-app-validate.c @@ -697,7 +697,8 @@ as_app_validate_icons (AsApp *app, AsAppValidateHelper *helper) break; case AS_ICON_KIND_LOCAL: icon_name = as_icon_get_filename (icon); - if (!g_str_has_prefix (icon_name, "/")) { + if (icon_name == NULL || + !g_str_has_prefix (icon_name, "/")) { ai_app_validate_add (helper, AS_PROBLEM_KIND_TAG_INVALID, "local icon is not a filename [%s]", @@ -706,7 +707,8 @@ as_app_validate_icons (AsApp *app, AsAppValidateHelper *helper) break; case AS_ICON_KIND_CACHED: icon_name = as_icon_get_name (icon); - if (g_str_has_prefix (icon_name, "/")) { + if (icon_name == NULL || + g_str_has_prefix (icon_name, "/")) { ai_app_validate_add (helper, AS_PROBLEM_KIND_TAG_INVALID, "cached icon is a filename [%s]", |