mirror of
https://github.com/NickHu/sway
synced 2024-12-27 21:58:11 +01:00
Add warnings about invalid output commands
This handles some cases where sway will crash if an output command is invalid/missing an argument.
This commit is contained in:
parent
01617131f1
commit
c477bbf345
1 changed files with 8 additions and 2 deletions
|
@ -767,8 +767,14 @@ static struct cmd_results *cmd_output(int argc, char **argv) {
|
|||
output->y = y;
|
||||
} else if (strcasecmp(argv[i], "bg") == 0 || strcasecmp(argv[i], "background") == 0) {
|
||||
wordexp_t p;
|
||||
char *src = argv[++i];
|
||||
char *mode = argv[++i];
|
||||
if (++i >= argc) {
|
||||
return cmd_results_new(CMD_INVALID, "output", "Missing background file.");
|
||||
}
|
||||
char *src = argv[i];
|
||||
if (++i >= argc) {
|
||||
return cmd_results_new(CMD_INVALID, "output", "Missing background scaling mode.");
|
||||
}
|
||||
char *mode = argv[i];
|
||||
if (wordexp(src, &p, 0) != 0) {
|
||||
return cmd_results_new(CMD_INVALID, "output", "Invalid syntax (%s)", src);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue