Check whether state store is connected when prompting to save files

This commit is contained in:
Ian Olsen
2017-01-17 16:15:12 -08:00
parent 682532c307
commit 64f53ee2db
2 changed files with 3 additions and 1 deletions

View File

@@ -10,10 +10,12 @@ class StateStore {
db.createObjectStore('states')
}
dbOpenRequest.onsuccess = () => {
this.isConnected = true
resolve(dbOpenRequest.result)
}
dbOpenRequest.onerror = (error) => {
console.error('Could not connect to indexedDB', error)
this.isConnected = false
resolve(null)
}
})

View File

@@ -892,7 +892,7 @@ class TextEditor extends Model
# Determine whether the user should be prompted to save before closing
# this editor.
shouldPromptToSave: ({windowCloseRequested, projectHasPaths}={}) ->
if windowCloseRequested and projectHasPaths
if windowCloseRequested and projectHasPaths and atom.stateStore.isConnected
false
else
@isModified() and not @buffer.hasMultipleEditors()