Skip to content

Commit

Permalink
Fixed NPE in ScriptError if INode is empty (#1985)
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Weitkamp <[email protected]>
  • Loading branch information
cweitkamp committed Jan 16, 2021
1 parent 07c3302 commit bccdb78
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,16 @@ public ScriptError(final String message, final int line, final int column, final
public ScriptError(final String message, final EObject atEObject) {
this.message = message;
INode node = NodeModelUtils.getNode(atEObject);
LineAndColumn lac = NodeModelUtils.getLineAndColumn(node, node.getOffset());
this.line = lac.getLine();
this.column = lac.getColumn();
this.length = node.getEndOffset() - node.getOffset();
if (node == null) {
this.line = 0;
this.column = 0;
this.length = -1;
} else {
LineAndColumn lac = NodeModelUtils.getLineAndColumn(node, node.getOffset());
this.line = lac.getLine();
this.column = lac.getColumn();
this.length = node.getEndOffset() - node.getOffset();
}
}

/**
Expand Down

0 comments on commit bccdb78

Please sign in to comment.