Ensure we don't run past the end of the tree text.