Skip to content
Permalink
Browse files

Ending comment without newline: bad! - #414

. If a spec file had a comment on its last line, but that last line did not have a newline, an NPE was throw. No longer.

[Bug][Toolbox]
  • Loading branch information
quaeler committed Jan 11, 2020
1 parent 795256f commit 7d274ad0d9ca22ff03ae22cf7a2715e6d83c4083
@@ -294,8 +294,14 @@ public void run() {
}
lastFoundIndex = find.getOffset();
final IRegion lineEnding = search.find((lastFoundIndex + find.getLength()), "\\n", true, true, false, true);
lastFoundIndex = lineEnding.getOffset();
find = search.find((lastFoundIndex + 1), SINGLE_LINE_COMMENT, true, true, false, true);
if (lineEnding != null) {
lastFoundIndex = lineEnding.getOffset();
find = search.find((lastFoundIndex + 1), SINGLE_LINE_COMMENT, true, true, false, true);
} else {
// In this case the document has ended without a newline (but with a comment)
lastFoundIndex += find.getLength();
find = null;
}

boolean addProjection = (contiguousLineCount > 1);
boolean reset = true;

0 comments on commit 7d274ad

Please sign in to comment.
You can’t perform that action at this time.