Community
Participate
Working Groups
I have a ISelectionChangedListener attached to my XtextSourceViewer which when called, calls (within a readonly transaction) NodeModelUtils#findLeafNodeAtOffset() with XtextResource.getParseResult().getRootNode() as the first argument and the selection offset obtained from the SelectionChangedEvent as the second argument. If the Xtext document is emtpy (i.e. length == 0) I get the following NPE when calling NodeModelUtils#findLeafNodeAtOffset(): java.lang.NullPointerException at org.eclipse.xtext.nodemodel.impl.BasicNodeTreeIterator.hasNext(BasicNodeTreeIterator.java:45) at org.eclipse.xtext.nodemodel.util.NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.java:67) That is because basicGetParent() returned null for the RootNode.
Marked as critical since the (Basic)TreeNodeIterator is used at other places, too.
Postponed since there are valid workarounds.
This one was already resolved with commit a40e333e7c964a391c4179c36afe11011104a3ea I could reproduce it with the previous version of the iterator but the tests are green for the released version.
Closing all bugs that were set to RESOLVED before Neon.0