aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-04-24 10:53:05 +0200
committerGitHub <noreply@github.com>2018-04-24 10:53:05 +0200
commit38c44f2f27f218ed7e61c9910491eef78551d8ea (patch)
tree0ce1e69200e8ff9528677ccd650de40679c278bb /sway
parent82cb3797275168c5618c7283a90cc84bf21beb45 (diff)
parent22b916963146d6235a49f3c9283e956e42fb22e9 (diff)
Merge pull request #1851 from RyanDwyer/container-descendants-crash
Fix crash in container_descendants()
Diffstat (limited to 'sway')
-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,
void container_descendants(struct sway_container *root,
enum sway_container_type type,
void (*func)(struct sway_container *item, void *data), void *data) {
+ if (!root->children || !root->children->length) {
+ return;
+ }
for (int i = 0; i < root->children->length; ++i) {
struct sway_container *item = root->children->items[i];
if (item->type == type) {
func(item, data);
}
- if (item->children && item->children->length) {
- container_descendants(item, type, func, data);
- }
+ container_descendants(item, type, func, data);
}
}