summaryrefslogtreecommitdiff
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c5
1 files changed, 4 insertions, 1 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,
struct focus_inactive_data *data = _data;
json_object *focus = data->object;
if (data->node == &root->node) {
- int len = json_object_array_length(focus);
struct sway_output *output = node_get_output(node);
+ if (output == NULL) {
+ return;
+ }
size_t id = output->node.id;
+ int len = json_object_array_length(focus);
for (int i = 0; i < len; ++i) {
if ((size_t) json_object_get_int(json_object_array_get_idx(focus, i)) == id) {
return;