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

Commit

Permalink
Ignore invalid TextEditors for fix jobs
Browse files Browse the repository at this point in the history
When a fix job is triggered but the TextEditor is invalid by the time
the job runs silently return.

Fixes #972.
  • Loading branch information
Arcanemagus committed Aug 9, 2017
1 parent cd7de8d commit aa609e6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,12 @@ module.exports = {
async fixJob(isSave = false) {
const textEditor = atom.workspace.getActiveTextEditor()

if (!textEditor || textEditor.isModified()) {
if (!textEditor || !atom.workspace.isTextEditor(textEditor)) {
// Silently return if the TextEditor is invalid
return
}

if (textEditor.isModified()) {
// Abort for invalid or unsaved text editors
const message = 'Linter-ESLint: Please save before fixing'
atom.notifications.addError(message)
Expand Down

0 comments on commit aa609e6

Please sign in to comment.