diff options
-rw-r--r-- | src/tree.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -254,16 +254,17 @@ static gboolean foreach_up(MqTree *node, gboolean (*cb)(MqTree *node, gpointer user_data), gpointer user_data) { - if (node->next) { - if (foreach_down(node->next, cb, user_data) == MQ_TREE_STOP) { - return MQ_TREE_STOP; - } + node = node->parent; + if (!node) { + return MQ_TREE_CONTINUE; } - if (node->parent) { - if (foreach_up(node->parent, cb, user_data) == MQ_TREE_STOP) { - return MQ_TREE_STOP; - } + if (foreach_down(node->next, cb, user_data) == MQ_TREE_STOP) { + return MQ_TREE_STOP; + } + + if (foreach_up(node, cb, user_data) == MQ_TREE_STOP) { + return MQ_TREE_STOP; } return MQ_TREE_CONTINUE; |