mirror of
https://github.com/swaywm/sway.git
synced 2024-12-28 07:56:31 +01:00
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`.
This commit is contained in:
parent
46561fc914
commit
0f5157668d
1 changed files with 4 additions and 1 deletions
|
@ -89,7 +89,10 @@ static bool validate_icon_theme(struct icon_theme *theme) {
|
||||||
static bool group_handler(char *old_group, char *new_group,
|
static bool group_handler(char *old_group, char *new_group,
|
||||||
struct icon_theme *theme) {
|
struct icon_theme *theme) {
|
||||||
if (!old_group) { // first group must be "Icon 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) {
|
if (strcmp(old_group, "Icon Theme") == 0) {
|
||||||
|
|
Loading…
Reference in a new issue