Skip to content

Commit 2a2aea8

Browse files
committed
Fix potential NoneType error in process_tree_labels function
1 parent 916a294 commit 2a2aea8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

cfetree/cfetree.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,9 @@ def process_tree_labels(t: toytree.ToyTree) -> toytree.ToyTree:
296296
for node in t.traverse():
297297
if node.dist is not None and node.dist < 0:
298298
d = abs(node.dist)
299-
for sibling in node.up.children:
300-
sibling._dist = (sibling.dist or 0) + d
299+
if node.up is not None:
300+
for sibling in node.up.children:
301+
sibling._dist = (sibling.dist or 0) + d
301302
node._dist = 0.0
302303
t._update()
303304

0 commit comments

Comments
 (0)