diff --git a/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/structure/YamlDocument.java b/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/structure/YamlDocument.java index 756162f47..cf01d4412 100644 --- a/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/structure/YamlDocument.java +++ b/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/structure/YamlDocument.java @@ -104,13 +104,15 @@ public class YamlDocument { //So comments never span multiple lines of text and we only have scan back //from offset upto the start of the current line. IRegion lineInfo = doc.getLineInformationOfOffset(offset); - int startOfLine = lineInfo.getOffset(); - while (offset>=startOfLine) { - char c = getChar(offset); - if (c=='#') { - return true; + if (lineInfo!=null) { + int startOfLine = lineInfo.getOffset(); + while (offset>=startOfLine) { + char c = getChar(offset); + if (c=='#') { + return true; + } + offset--; } - offset--; } return false; }