diff options
-rw-r--r-- | sway/ipc-json.c | 5 | ||||
-rw-r--r-- | sway/tree/node.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 30c0a8e1..52278be2 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -316,9 +316,12 @@ static void focus_inactive_children_iterator(struct sway_node *node, | |||
316 | struct focus_inactive_data *data = _data; | 316 | struct focus_inactive_data *data = _data; |
317 | json_object *focus = data->object; | 317 | json_object *focus = data->object; |
318 | if (data->node == &root->node) { | 318 | if (data->node == &root->node) { |
319 | int len = json_object_array_length(focus); | ||
320 | struct sway_output *output = node_get_output(node); | 319 | struct sway_output *output = node_get_output(node); |
320 | if (output == NULL) { | ||
321 | return; | ||
322 | } | ||
321 | size_t id = output->node.id; | 323 | size_t id = output->node.id; |
324 | int len = json_object_array_length(focus); | ||
322 | for (int i = 0; i < len; ++i) { | 325 | for (int i = 0; i < len; ++i) { |
323 | if ((size_t) json_object_get_int(json_object_array_get_idx(focus, i)) == id) { | 326 | if ((size_t) json_object_get_int(json_object_array_get_idx(focus, i)) == id) { |
324 | return; | 327 | return; |
diff --git a/sway/tree/node.c b/sway/tree/node.c index 74661c1a..dcab1c9b 100644 --- a/sway/tree/node.c +++ b/sway/tree/node.c | |||
@@ -74,8 +74,10 @@ void node_get_box(struct sway_node *node, struct wlr_box *box) { | |||
74 | 74 | ||
75 | struct sway_output *node_get_output(struct sway_node *node) { | 75 | struct sway_output *node_get_output(struct sway_node *node) { |
76 | switch (node->type) { | 76 | switch (node->type) { |
77 | case N_CONTAINER: | 77 | case N_CONTAINER: { |
78 | return node->sway_container->workspace->output; | 78 | struct sway_workspace *ws = node->sway_container->workspace; |
79 | return ws ? ws->output : NULL; | ||
80 | } | ||
79 | case N_WORKSPACE: | 81 | case N_WORKSPACE: |
80 | return node->sway_workspace->output; | 82 | return node->sway_workspace->output; |
81 | case N_OUTPUT: | 83 | case N_OUTPUT: |