From 557de84b2ed6df147ba0f3be76ed6efc1477b667 Mon Sep 17 00:00:00 2001 From: Julian Valentin Date: Mon, 16 Sep 2019 11:18:25 +0200 Subject: [PATCH] Fix NullPointerException in codeAction Fixes #1. --- src/main/java/LanguageToolLanguageServer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/LanguageToolLanguageServer.java b/src/main/java/LanguageToolLanguageServer.java index 5c001d5f..fcbc031b 100644 --- a/src/main/java/LanguageToolLanguageServer.java +++ b/src/main/java/LanguageToolLanguageServer.java @@ -260,6 +260,11 @@ public CompletableFuture>> codeAction( VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier( document.getUri(), document.getVersion()); Pair, AnnotatedText> validateResult = validateDocument(document); + + if (validateResult.getValue() == null) { + return CompletableFuture.completedFuture(Collections.emptyList()); + } + String text = document.getText(); String plainText = validateResult.getValue().getPlainText(); AnnotatedText inverseAnnotatedText = null;