Skip to content

Commit

Permalink
GroovyLanguageServerUtils: return null from syntaxExceptionToRange() …
Browse files Browse the repository at this point in the history
…if exception start or end line is -1 (closes #90)
  • Loading branch information
joshtynjala committed Jun 26, 2024
1 parent 11b8b5f commit 747ee29
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,15 @@ public static Position createGroovyPosition(int groovyLine, int groovyColumn) {
}

public static Range syntaxExceptionToRange(SyntaxException exception) {
return new Range(createGroovyPosition(exception.getStartLine(), exception.getStartColumn()),
createGroovyPosition(exception.getEndLine(), exception.getEndColumn()));
Position start = createGroovyPosition(exception.getStartLine(), exception.getStartColumn());
if (start == null) {
return null;
}
Position end = createGroovyPosition(exception.getEndLine(), exception.getEndColumn())
if (end == null) {
return null;
}
return new Range(start, end);
}

/**
Expand Down

0 comments on commit 747ee29

Please sign in to comment.