ipc: handle NULL cases for node_get_output

This commit is contained in:
Ian Fan 2018-09-15 09:42:46 +01:00
parent 1c292fd43a
commit 34dbbb1314
2 changed files with 8 additions and 3 deletions

View file

@ -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;