For an empty tree like thing, use new EmptyTreeIterator() instead.  When you later ask for this slot as a CanonicalTreeParser type you will get back a null pointer.  (TreeWalk internally creates an EmptyTreeIterator as it dives down into non-existent subdirectories.)