diff options
Diffstat (limited to 'swaybar/tray/icon.c')
-rw-r--r-- | swaybar/tray/icon.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c index 56f230e1..c7e7f6bc 100644 --- a/swaybar/tray/icon.c +++ b/swaybar/tray/icon.c | |||
@@ -82,6 +82,10 @@ static int cmp_group(const void *item, const void *cmp_to) { | |||
82 | return strcmp(item, cmp_to); | 82 | return strcmp(item, cmp_to); |
83 | } | 83 | } |
84 | 84 | ||
85 | static bool validate_icon_theme(struct icon_theme *theme) { | ||
86 | return theme && theme->name && theme->comment && theme->directories; | ||
87 | } | ||
88 | |||
85 | static bool group_handler(char *old_group, char *new_group, | 89 | static bool group_handler(char *old_group, char *new_group, |
86 | struct icon_theme *theme) { | 90 | struct icon_theme *theme) { |
87 | if (!old_group) { // first group must be "Icon Theme" | 91 | if (!old_group) { // first group must be "Icon Theme" |
@@ -89,7 +93,7 @@ static bool group_handler(char *old_group, char *new_group, | |||
89 | } | 93 | } |
90 | 94 | ||
91 | if (strcmp(old_group, "Icon Theme") == 0) { | 95 | if (strcmp(old_group, "Icon Theme") == 0) { |
92 | if (!(theme->name && theme->comment && theme->directories)) { | 96 | if (!validate_icon_theme(theme)) { |
93 | return true; | 97 | return true; |
94 | } | 98 | } |
95 | } else { | 99 | } else { |
@@ -276,7 +280,7 @@ static struct icon_theme *read_theme_file(char *basedir, char *theme_name) { | |||
276 | free(full_line); | 280 | free(full_line); |
277 | fclose(theme_file); | 281 | fclose(theme_file); |
278 | 282 | ||
279 | if (!error) { | 283 | if (!error && validate_icon_theme(theme)) { |
280 | theme->dir = strdup(theme_name); | 284 | theme->dir = strdup(theme_name); |
281 | return theme; | 285 | return theme; |
282 | } else { | 286 | } else { |