Don't walk over empty trees
authorAlan T. DeKok <aland@freeradius.org>
Tue, 26 May 2009 13:00:41 +0000 (15:00 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 26 May 2009 13:00:41 +0000 (15:00 +0200)
src/lib/rbtree.c

index 365423c..3a5a7ca 100644 (file)
@@ -587,6 +587,8 @@ static int WalkNodePostOrder(rbnode_t *X,
 int rbtree_walk(rbtree_t *tree, RBTREE_ORDER order,
                int (*callback)(void *, void *), void *context)
 {
+       if (tree->Root == NIL) return 0;
+
        switch (order) {
        case PreOrder:
                return WalkNodePreOrder(tree->Root, callback, context);