Explorar o código

Only recurse depth wise in `Tree::_count_selected_items`

ACB hai 1 ano
pai
achega
43038bbfcb
Modificáronse 1 ficheiros con 2 adicións e 6 borrados
  1. 2 6
      scene/gui/tree.cpp

+ 2 - 6
scene/gui/tree.cpp

@@ -2587,12 +2587,8 @@ int Tree::_count_selected_items(TreeItem *p_from) const {
 		}
 	}
 
-	if (p_from->get_first_child()) {
-		count += _count_selected_items(p_from->get_first_child());
-	}
-
-	if (p_from->get_next()) {
-		count += _count_selected_items(p_from->get_next());
+	for (TreeItem *c = p_from->get_first_child(); c; c = c->get_next()) {
+		count += _count_selected_items(c);
 	}
 
 	return count;