Closed ms609 closed 1 year ago
For testing purposes, here is the zero-length tree object that brought my attention to the issue:
noLeafTree <- structure(list(edge = structure(numeric(0), dim = c(0L, 2L)),
tip.label = character(0), Nnode = 0), class = "phylo")
This is great! I'm opening an issue to follow-up on this. Many thanks.
Some operations can produce zero-leaf trees: for example, reducing a pair of trees by retaining only the leaves they hold in common.
Such zero-leaf trees throw errors in certain ape functions, where it would be appropriate to silently return the zero-leaf tree that was input.
I have proposed modifications to the two functions that have been causing issues where they are called in downstream functions in TreeTools and TreeDist – though there may be mileage in handling this case safely in other functions too.