Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 57f9322

Browse files
committed
Guard against pathless TextEditor
Somehow we can get called on a TextEditor that doesn't have a path associated with it. Guard against this case. Fixes #119.
1 parent 6a2660c commit 57f9322

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export default {
2929
lintOnFly: true,
3030
lint: async (textEditor) => {
3131
const filePath = textEditor.getPath();
32+
if (!filePath) {
33+
// We somehow got called without a file path
34+
return null;
35+
}
3236
const fileText = textEditor.getText();
3337
const fileExtension = extname(filePath).substr(1);
3438

0 commit comments

Comments
 (0)