From e4f80877bea48eb29b4ddfbce923bf78a6694ffb Mon Sep 17 00:00:00 2001 From: thuck Date: Fri, 3 Jun 2016 00:05:10 +0200 Subject: [PATCH] Fix output command when varible not set This should fix the corner case where a variable is not assigned, but used anyway. This should solve partially the issue #681. --- sway/commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/commands.c b/sway/commands.c index 3ccbcd2e..febff2dd 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1632,7 +1632,7 @@ static struct cmd_results *cmd_output(int argc, char **argv) { } char *src = join_args(argv + i, argc - i - 1); char *mode = argv[argc - 1]; - if (wordexp(src, &p, 0) != 0) { + if (wordexp(src, &p, 0) != 0 || p.we_wordv[0] == NULL) { return cmd_results_new(CMD_INVALID, "output", "Invalid syntax (%s)", src); } free(src);