diff --git a/src/tree.c b/src/tree.c index 721e0b9c..48a25eb2 100644 --- a/src/tree.c +++ b/src/tree.c @@ -525,7 +525,7 @@ void tree_flatten(Con *con) { /* Ensure it got only one child */ child = TAILQ_FIRST(&(con->nodes_head)); - if (TAILQ_NEXT(child, nodes) != NULL) + if (child == NULL || TAILQ_NEXT(child, nodes) != NULL) goto recurse; /* The child must have a different orientation than the con but the same as