aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-04-24 10:53:05 +0200
committerLibravatar GitHub <noreply@github.com>2018-04-24 10:53:05 +0200
commit38c44f2f27f218ed7e61c9910491eef78551d8ea (patch)
tree0ce1e69200e8ff9528677ccd650de40679c278bb
parentMerge pull request #1843 from swaywm/layer-optional-output (diff)
parentFix crash in container_descendants() (diff)
downloadsway-38c44f2f27f218ed7e61c9910491eef78551d8ea.tar.gz
sway-38c44f2f27f218ed7e61c9910491eef78551d8ea.tar.zst
sway-38c44f2f27f218ed7e61c9910491eef78551d8ea.zip
Merge pull request #1851 from RyanDwyer/container-descendants-crash
Fix crash in container_descendants()
-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