From b2d4caf6c34d8b6f6eccb9872a7d95772be19c10 Mon Sep 17 00:00:00 2001 From: lbonn Date: Sun, 8 Oct 2017 02:14:20 +0200 Subject: commands: fail when criteria match nothing For whatever command, this probably was not intended by the user --- sway/commands.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sway/commands.c b/sway/commands.c index d55d9a96..c7dbf731 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -458,7 +458,11 @@ struct cmd_results *handle_command(char *_exec, enum command_context context) { if (!containers) { current_container = get_focused_container(&root_container); } else if (containers->length == 0) { - break; + if (results) { + free_cmd_results(results); + } + results = cmd_results_new(CMD_FAILURE, argv[0], "No matching container"); + goto cleanup; } else { current_container = (swayc_t *)containers->items[i]; } -- cgit v1.2.3-54-g00ecf