Skip to content

Commit

Permalink
Don’t throw when generateRange() throws
Browse files Browse the repository at this point in the history
Fixes #200.
  • Loading branch information
sonicdoe committed Sep 15, 2017
1 parent 5178225 commit 05f787f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/utils/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ function getRange (textEditor, line, col, endLine, endCol, src, lineStart) {
return [[line, col], [endLine, endCol]]
}

return generateRange(textEditor, line, col)
try {
return generateRange(textEditor, line, col)
} catch (err) {
// If generateRange() fails, the text editor’s contents have most likely
// changed in the meantime. In that case, we simply return a one-character
// range since the results won’t be used anyway.
return [[line, col], [line, col + 1]]
}
}

module.exports = function (err, output) {
Expand Down

0 comments on commit 05f787f

Please sign in to comment.