mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 17:31:28 +00:00
Check argc>0 before strcasecmp. Should shortcircuit
This commit is contained in:
parent
450b40c635
commit
a576bc27bf
|
@ -921,19 +921,13 @@ struct cmd_results *cmd_move(int argc, char **argv) {
|
|||
--argc; ++argv;
|
||||
}
|
||||
|
||||
if (strcasecmp(argv[0], "window") == 0 ||
|
||||
strcasecmp(argv[0], "container") == 0) {
|
||||
--argc;
|
||||
if (argc > 0) {
|
||||
++argv;
|
||||
}
|
||||
if (argc > 0 && (strcasecmp(argv[0], "window") == 0 ||
|
||||
strcasecmp(argv[0], "container") == 0)) {
|
||||
--argc; ++argv;
|
||||
}
|
||||
|
||||
if (strcasecmp(argv[0], "to") == 0) {
|
||||
--argc;
|
||||
if (argc > 0) {
|
||||
++argv;
|
||||
}
|
||||
if (argc > 0 && strcasecmp(argv[0], "to") == 0) {
|
||||
--argc; ++argv;
|
||||
}
|
||||
|
||||
if (!argc) {
|
||||
|
|
Loading…
Reference in a new issue