From: Holger Schemel Date: Fri, 3 Sep 2021 13:22:48 +0000 (+0200) Subject: fixed tree node navigation bug (when stepping up empty sub-trees) X-Git-Tag: 4.3.0.0~84 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8d2e9e21529dc319434b41ef95ecc6364c806fb5;p=rocksndiamonds.git fixed tree node navigation bug (when stepping up empty sub-trees) --- diff --git a/src/libgame/setup.c b/src/libgame/setup.c index dfd9ac61..403d0dae 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -1300,10 +1300,11 @@ TreeInfo *getFirstValidTreeInfoEntry(TreeInfo *node) if (node->parent_link) // skip first node (back link) of node group { - if (node->next) // get next regular node - return getFirstValidTreeInfoEntry(node->next); - else // leave empty node group and go on - return getFirstValidTreeInfoEntry(node->node_parent->next); + // get next regular tree node, or step up until one is found + while (node->next == NULL && node->node_parent != NULL) + node = node->node_parent; + + return getFirstValidTreeInfoEntry(node->next); } // this is a regular tree node