From: Jean-Paul Saman Date: Sat, 14 Oct 2006 13:27:15 +0000 (+0000) Subject: Correctly count the children of a node. The previous code counted the endpoints too... X-Git-Tag: 0.9.0-test0~9974 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=d549e5a0cfd8b2ece0261e197b98d2d34666bd5d;p=vlc Correctly count the children of a node. The previous code counted the endpoints too, which gave a too high children count. --- diff --git a/src/playlist/tree.c b/src/playlist/tree.c index 9ff52e251a..4d53d2935d 100644 --- a/src/playlist/tree.c +++ b/src/playlist/tree.c @@ -247,13 +247,15 @@ int playlist_NodeChildrenCount( playlist_t *p_playlist, playlist_item_t*p_node) { int i; int i_nb = 0; + if( p_node->i_children == -1 ) return 0; + i_nb = p_node->i_children; for( i=0 ; i< p_node->i_children;i++ ) { if( p_node->pp_children[i]->i_children == -1 ) - i_nb++; + break;; else i_nb += playlist_NodeChildrenCount( p_playlist, p_node->pp_children[i] );