From e840a34fef5bbf4487884434f8312ade4b101ce6 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 23 Sep 2005 06:25:13 +0000 Subject: [PATCH] Fix end conditions for tavl_end and tavl_next --- libraries/liblutil/tavl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/liblutil/tavl.c b/libraries/liblutil/tavl.c index d2a4ccf428..9a7c9a31f2 100644 --- a/libraries/liblutil/tavl.c +++ b/libraries/liblutil/tavl.c @@ -475,7 +475,7 @@ Avlnode * tavl_end( Avlnode *root, int dir ) { if ( root ) { - while ( root->avl_bits[dir] == AVL_CHILD ) + while ( root->avl_bits[dir] == AVL_CHILD && root->avl_link[dir] ) root = root->avl_link[dir]; } return root; @@ -491,7 +491,7 @@ tavl_next( Avlnode *root, int dir ) root = root->avl_link[dir]; if ( c == AVL_CHILD ) { dir ^= 1; - while ( root->avl_bits[dir] == AVL_CHILD ) + while ( root && root->avl_bits[dir] == AVL_CHILD ) root = root->avl_link[dir]; } } -- 2.39.5