aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/focus.c
diff options
context:
space:
mode:
authorLibravatar lbonn <bonnans.l@gmail.com>2019-10-19 16:25:55 +0200
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-11-01 12:18:09 -0400
commitcf95de9cae0561a58d6435802411dcee63ef2f5f (patch)
tree99ade1a3c56b485d17d7226130277708ef319e57 /sway/commands/focus.c
parentFix potential NULL reference on cleanup (diff)
downloadsway-cf95de9cae0561a58d6435802411dcee63ef2f5f.tar.gz
sway-cf95de9cae0561a58d6435802411dcee63ef2f5f.tar.zst
sway-cf95de9cae0561a58d6435802411dcee63ef2f5f.zip
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 (limited to 'sway/commands/focus.c')
-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) {
414 return cmd_results_new(CMD_SUCCESS, NULL); 414 return cmd_results_new(CMD_SUCCESS, NULL);
415 } 415 }
416 416
417 if (!sway_assert(container, "Expected container to be non null")) {
418 return cmd_results_new(CMD_FAILURE, "");
419 }
417 struct sway_node *next_focus = NULL; 420 struct sway_node *next_focus = NULL;
418 if (container_is_floating(container)) { 421 if (container_is_floating(container)) {
419 next_focus = node_get_in_direction_floating(container, seat, direction); 422 next_focus = node_get_in_direction_floating(container, seat, direction);