diff options
author | lbonn <bonnans.l@gmail.com> | 2017-10-08 02:14:20 +0200 |
---|---|---|
committer | lbonn <bonnans.l@gmail.com> | 2017-10-08 11:54:46 +0200 |
commit | b2d4caf6c34d8b6f6eccb9872a7d95772be19c10 (patch) | |
tree | f14c803c1ae0317b456b77b989fa5104cbffc24e | |
parent | commands: allow criterion values to be unquoted (diff) | |
download | sway-b2d4caf6c34d8b6f6eccb9872a7d95772be19c10.tar.gz sway-b2d4caf6c34d8b6f6eccb9872a7d95772be19c10.tar.zst sway-b2d4caf6c34d8b6f6eccb9872a7d95772be19c10.zip |
commands: fail when criteria match nothing
For whatever command, this probably was not intended by the user
-rw-r--r-- | sway/commands.c | 6 |
1 files changed, 5 insertions, 1 deletions
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) { | |||
458 | if (!containers) { | 458 | if (!containers) { |
459 | current_container = get_focused_container(&root_container); | 459 | current_container = get_focused_container(&root_container); |
460 | } else if (containers->length == 0) { | 460 | } else if (containers->length == 0) { |
461 | break; | 461 | if (results) { |
462 | free_cmd_results(results); | ||
463 | } | ||
464 | results = cmd_results_new(CMD_FAILURE, argv[0], "No matching container"); | ||
465 | goto cleanup; | ||
462 | } else { | 466 | } else { |
463 | current_container = (swayc_t *)containers->items[i]; | 467 | current_container = (swayc_t *)containers->items[i]; |
464 | } | 468 | } |