Shortcut in pathfinder, no need to recurse if we don't have any flags left.