sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 0f5157668da3cbf614a2f71ff24778ed62bad1ea
parent 46561fc914b26d37c0ffac3c03ad09c27c2d6c2b
Author: Till Hofmann <thofmann@fedoraproject.org>
Date:   Mon, 10 Feb 2020 13:05:16 +0100

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:
Mswaybar/tray/icon.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c @@ -89,7 +89,10 @@ 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" - return strcmp(new_group, "Icon Theme"); + if (!new_group) { + return true; + } + return strcmp(new_group, "Icon Theme") != 0; } if (strcmp(old_group, "Icon Theme") == 0) {