Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 34e6be9

Browse files
committed
Merge pull request #6442 from busykai/fix-6441
Fix #6441.
2 parents f234147 + 0f0ee7f commit 34e6be9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/language/CodeInspection.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,14 @@ define(function (require, exports, module) {
311311

312312
if (inspectionResult.result) {
313313
inspectionResult.result.errors.forEach(function (error) {
314-
// some inspectors don't always provide a line number
315-
if (!isNaN(error.pos.line)) {
314+
// some inspectors don't always provide a line number or report a negative line number
315+
if (!isNaN(error.pos.line) &&
316+
(error.pos.line + 1) > 0 &&
317+
(error.codeSnippet = currentDoc.getLine(error.pos.line)) !== undefined) {
316318
error.friendlyLine = error.pos.line + 1;
317-
error.codeSnippet = currentDoc.getLine(error.pos.line);
318319
error.codeSnippet = error.codeSnippet.substr(0, Math.min(175, error.codeSnippet.length)); // limit snippet width
319-
}
320-
320+
}
321+
321322
if (error.type !== Type.META) {
322323
numProblems++;
323324
}

0 commit comments

Comments
 (0)