From ac20d02c0ab2b0398d109257493904be6eb192b0 Mon Sep 17 00:00:00 2001 From: Ryan Farley Date: Tue, 24 Mar 2020 09:57:25 -0500 Subject: [PATCH] check for name in workspace gaps command as well A malformed command here will lead to the same result seen in #5131, so add a check. Done inside the cmd_workspace_gaps() function itself, to take advantage of the existing 'Expected...' string. --- sway/commands/workspace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 0d74e0f21..2858a2840 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c @@ -60,6 +60,9 @@ static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, int gaps_location) { const char expected[] = "Expected 'workspace gaps " "inner|outer|horizontal|vertical|top|right|bottom|left '"; + if (gaps_location == 0) { + return cmd_results_new(CMD_INVALID, expected); + } struct cmd_results *error = NULL; if ((error = checkarg(argc, "workspace", EXPECTED_EQUAL_TO, gaps_location + 3))) {