summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin J. Kim <justinjoy@users.noreply.github.com>2016-08-19 20:28:50 +0900
committerRichard Hughes <richard@hughsie.com>2016-08-19 12:28:50 +0100
commitec9659b78b306a404aa13030d3087ea079157dc4 (patch)
treedf0473c74f4460c8be587d7a1c34e7518a45166b
parent08ac962332e27b13bf79e3bce3450ffe71c670a6 (diff)
downloadappstream-glib-ec9659b78b306a404aa13030d3087ea079157dc4.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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c
index 4b46ae4..4e435c8 100644
--- a/libappstream-glib/as-app-validate.c
+++ b/libappstream-glib/as-app-validate.c
@@ -709,7 +709,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]",
@@ -718,7 +719,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]",