aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-04-24 12:27:04 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-04-24 12:27:04 +1000
commit22b916963146d6235a49f3c9283e956e42fb22e9 (patch)
tree0ce1e69200e8ff9528677ccd650de40679c278bb /sway/tree
parentMerge pull request #1843 from swaywm/layer-optional-output (diff)
downloadsway-22b916963146d6235a49f3c9283e956e42fb22e9.tar.gz
sway-22b916963146d6235a49f3c9283e956e42fb22e9.tar.zst
sway-22b916963146d6235a49f3c9283e956e42fb22e9.zip
Fix crash in container_descendants()
If root is a C_VIEW, the children property is a null pointer.
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index f14e9b9a..bd9f9894 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -355,14 +355,15 @@ struct sway_container *container_view_create(struct sway_container *sibling,
355void container_descendants(struct sway_container *root, 355void container_descendants(struct sway_container *root,
356 enum sway_container_type type, 356 enum sway_container_type type,
357 void (*func)(struct sway_container *item, void *data), void *data) { 357 void (*func)(struct sway_container *item, void *data), void *data) {
358 if (!root->children || !root->children->length) {
359 return;
360 }
358 for (int i = 0; i < root->children->length; ++i) { 361 for (int i = 0; i < root->children->length; ++i) {
359 struct sway_container *item = root->children->items[i]; 362 struct sway_container *item = root->children->items[i];
360 if (item->type == type) { 363 if (item->type == type) {
361 func(item, data); 364 func(item, data);
362 } 365 }
363 if (item->children && item->children->length) { 366 container_descendants(item, type, func, data);
364 container_descendants(item, type, func, data);
365 }
366 } 367 }
367} 368}
368 369