mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 18:01:29 +00:00
commands: Gracefully handle empty commands.
Before this patch sway would proceed into find_handler which would cause a crash trying to parse a NULL string. This could be triggered via e.g. `i3-msg -s $(sway --get-socketpath)`.
This commit is contained in:
parent
83c23f274c
commit
e3837ba634
|
@ -1178,6 +1178,11 @@ enum cmd_status handle_command(char *_exec) {
|
||||||
// Split commands
|
// Split commands
|
||||||
cmd = argsep(&cmdlist, ",");
|
cmd = argsep(&cmdlist, ",");
|
||||||
cmd += strspn(cmd, whitespace);
|
cmd += strspn(cmd, whitespace);
|
||||||
|
if (strcmp(cmd, "") == 0) {
|
||||||
|
sway_log(L_INFO, "Ignoring empty command.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
sway_log(L_INFO, "Handling command '%s'", cmd);
|
sway_log(L_INFO, "Handling command '%s'", cmd);
|
||||||
//TODO better handling of argv
|
//TODO better handling of argv
|
||||||
int argc;
|
int argc;
|
||||||
|
|
Loading…
Reference in a new issue