commit 45ac9648bf1c1d1d9a75c5a6097c2a32e7c0392f
Author: Till Hofmann <thofmann@fedoraproject.org>
Date: Sun Feb 9 13:03:52 2020 +0100
Avoid calling strcmp on nullptr
The function group_handler may get a nullptr as `new_group`. If that's
the case, return -1, as if `new_group` was the empty string.
diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c
index 8adefda6..c383bc63 100644
--- a/swaybar/tray/icon.c
+++ b/swaybar/tray/icon.c
@@ -89,6 +89,9 @@ static bool validate_icon_theme(struct icon_theme *theme) {
static bool group_handler(char *old_group, char *new_group,
struct icon_theme *theme) {
if (!old_group) { // first group must be "Icon Theme"
+ if (!new_group) {
+ return -1;
+ }
return strcmp(new_group, "Icon Theme");
}