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

Commit

Permalink
Merge pull request #544 from AtomLinter/arcanemagus/path-guard
Browse files Browse the repository at this point in the history
Guard against invalid TextEditor and empty paths
  • Loading branch information
Arcanemagus authored Dec 6, 2017
2 parents 4311397 + f0e03bb commit 80058bc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,21 @@ export default {
scope: 'file',
lintOnFly: true,
lint: async (textEditor) => {
loadDeps();
if (!atom.workspace.isTextEditor(textEditor)) {
// Invalid TextEditor
return null;
}

const filePath = textEditor.getPath();
if (!filePath) {
// Invalid path
return null;
}
const fileText = textEditor.getText();

// Load dependencies if they aren't already
loadDeps();

const parameters = ['--format=default'];

const projectPath = atom.project.relativizePath(filePath)[0];
Expand Down

0 comments on commit 80058bc

Please sign in to comment.