From ccc5dc547ce46bff319f270b3c093fb1db76f1ae Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 12 Jun 2004 03:17:19 +0000 Subject: [PATCH] fix bug causing runaway recursion --- panda/src/pgraph/nodePath.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/panda/src/pgraph/nodePath.cxx b/panda/src/pgraph/nodePath.cxx index c81331f544..c046859ca2 100644 --- a/panda/src/pgraph/nodePath.cxx +++ b/panda/src/pgraph/nodePath.cxx @@ -3717,9 +3717,16 @@ void NodePath:: r_find_matches(NodePathCollection &result, const FindApproxLevel &level, int max_matches, int num_levels_remaining) const { + if (pgraph_cat.is_debug()) { + pgraph_cat.debug() + << "r_find_matches(" << result << ", level, " + << max_matches << ", " << num_levels_remaining << ")\n"; + level.write(pgraph_cat.debug(false)); + } + // Go on to the next level. If we exceeded the requested maximum - // depth, stop. - if (num_levels_remaining <= 0) { + // depth (or if there are no more levels to visit), stop. + if (num_levels_remaining <= 0 || level._v.empty()) { return; } num_levels_remaining--;