commit cf95de9cae0561a58d6435802411dcee63ef2f5f
parent 30fa7d191e031797c182fcec93f20ae9124ea664
Author: lbonn <bonnans.l@gmail.com>
Date: Sat, 19 Oct 2019 16:25:55 +0200
focus: add a NULL check in `focus <direction>`
container is checked for NULL in other conditions earlier, it's not
obvious that it can't be undefined here.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
@@ -414,6 +414,9 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
return cmd_results_new(CMD_SUCCESS, NULL);
}
+ if (!sway_assert(container, "Expected container to be non null")) {
+ return cmd_results_new(CMD_FAILURE, "");
+ }
struct sway_node *next_focus = NULL;
if (container_is_floating(container)) {
next_focus = node_get_in_direction_floating(container, seat, direction);