Skip to content

Commit 60f5f91

Browse files
committed
fix tree print
1 parent 0fa6bcb commit 60f5f91

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
* Changed `SceneObject.frame` to read-only result of `Frame.from_transformation(SceneObject.worldtransformation)`, representing the local coordinate system of the scene object in world coordinates.
2020
* Changed `SceneObject.worldtransformation` to the multiplication of all transformations from the scene object to the root of the scene tree, there will no longer be an additional transformation in relation to the object's frame.
2121
* Fixed call to `astar_shortest_path` in `Graph.shortest_path`.
22+
* Fixed a bug when printing an empty `Tree`.
2223

2324
### Removed
2425

src/compas/datastructures/tree/tree.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@ def traverse(node, hierarchy, prefix="", last=True, depth=0):
465465
for i, child in enumerate(node.children):
466466
traverse(child, hierarchy, prefix, i == len(node.children) - 1, depth + 1)
467467

468-
traverse(self.root, hierarchy)
468+
if self.root:
469+
traverse(self.root, hierarchy)
469470

470471
return "\n".join(hierarchy)
471472

0 commit comments

Comments
 (0)