You're welcome.
And the good thing is, this isn't even a trick or workaround - it's documented:
Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.