aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar
diff options
context:
space:
mode:
authorLibravatar Till Hofmann <thofmann@fedoraproject.org>2020-02-10 13:05:16 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2020-02-10 13:29:07 +0100
commit0f5157668da3cbf614a2f71ff24778ed62bad1ea (patch)
tree8c8b57327e880f38651a376d1f8d8a88e1db204f /swaybar
parentFix seat_set_focus_layer crash when disabling output (diff)
downloadsway-0f5157668da3cbf614a2f71ff24778ed62bad1ea.tar.gz
sway-0f5157668da3cbf614a2f71ff24778ed62bad1ea.tar.zst
sway-0f5157668da3cbf614a2f71ff24778ed62bad1ea.zip
Avoid calling strcmp on nullptr
The function group_handler may get a nullptr as `new_group`. If that's the case, return true, as if `new_group` was the empty string. Also make the conversion to bool explicit when calling `strcmp`.
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/tray/icon.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c
index 8adefda6..d0c3fa56 100644
--- a/swaybar/tray/icon.c
+++ b/swaybar/tray/icon.c
@@ -89,7 +89,10 @@ static bool validate_icon_theme(struct icon_theme *theme) {
89static bool group_handler(char *old_group, char *new_group, 89static bool group_handler(char *old_group, char *new_group,
90 struct icon_theme *theme) { 90 struct icon_theme *theme) {
91 if (!old_group) { // first group must be "Icon Theme" 91 if (!old_group) { // first group must be "Icon Theme"
92 return strcmp(new_group, "Icon Theme"); 92 if (!new_group) {
93 return true;
94 }
95 return strcmp(new_group, "Icon Theme") != 0;
93 } 96 }
94 97
95 if (strcmp(old_group, "Icon Theme") == 0) { 98 if (strcmp(old_group, "Icon Theme") == 0) {