diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-09-15 09:42:46 +0100 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-09-15 09:42:49 +0100 |
commit | 34dbbb1314af16e388c7517aec6427baa00fb179 (patch) | |
tree | a05b996b9f513e008f8879fab5604462853e156b /sway/ipc-json.c | |
parent | ipc: add focus information to root node (diff) | |
download | sway-34dbbb1314af16e388c7517aec6427baa00fb179.tar.gz sway-34dbbb1314af16e388c7517aec6427baa00fb179.tar.zst sway-34dbbb1314af16e388c7517aec6427baa00fb179.zip |
ipc: handle NULL cases for node_get_output
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r-- | sway/ipc-json.c | 5 |
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, | |||
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; |