Check argc>0 before strcasecmp. Should shortcircuit

This commit is contained in:
Jason Nader 2020-01-18 18:33:43 +09:00 committed by Simon Ser
parent 450b40c635
commit a576bc27bf

View file

@ -921,19 +921,13 @@ struct cmd_results *cmd_move(int argc, char **argv) {
--argc; ++argv; --argc; ++argv;
} }
if (strcasecmp(argv[0], "window") == 0 || if (argc > 0 && (strcasecmp(argv[0], "window") == 0 ||
strcasecmp(argv[0], "container") == 0) { strcasecmp(argv[0], "container") == 0)) {
--argc; --argc; ++argv;
if (argc > 0) {
++argv;
}
} }
if (strcasecmp(argv[0], "to") == 0) { if (argc > 0 && strcasecmp(argv[0], "to") == 0) {
--argc; --argc; ++argv;
if (argc > 0) {
++argv;
}
} }
if (!argc) { if (!argc) {