aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2019-10-19 16:25:55 +0200
committerFurkan Sahin <furkan-dev@proton.me>2019-10-19 16:25:55 +0200
commit38fe1ee730d5dc2a054495d9f470f04df5b44bc7 (patch)
tree99ade1a3c56b485d17d7226130277708ef319e57
parentf4698246c953d6165f38b460c07a2a575fa75ebf (diff)
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.
-rw-r--r--sway/commands/focus.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 99c7e61e..844d1293 100644
--- 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);