Fix NPE in case tree has no items