diff --git a/src/main/java/net/prominic/groovyls/GroovyServices.java b/src/main/java/net/prominic/groovyls/GroovyServices.java index 93b3f7d..b234642 100644 --- a/src/main/java/net/prominic/groovyls/GroovyServices.java +++ b/src/main/java/net/prominic/groovyls/GroovyServices.java @@ -489,6 +489,11 @@ private Set handleErrorCollector(ErrorCollector collec SyntaxErrorMessage syntaxErrorMessage = (SyntaxErrorMessage) message; SyntaxException cause = syntaxErrorMessage.getCause(); Range range = GroovyLanguageServerUtils.syntaxExceptionToRange(cause); + if (range == null) { + // range can't be null in a Diagnostic, so we need + // a fallback + range = new Range(new Position(0, 0), new Position(0, 0)); + } Diagnostic diagnostic = new Diagnostic(); diagnostic.setRange(range); diagnostic.setSeverity(cause.isFatal() ? DiagnosticSeverity.Error : DiagnosticSeverity.Warning);