mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-11 05:41:52 +01:00
Fixed NPE in ScriptError if INode is empty (#1985)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
bf14e1077f
commit
7ce96ac06a
@ -62,10 +62,16 @@ public final class ScriptError {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user