Check if error message exists before using it

This commit is contained in:
Ivan Zuzak
2015-07-05 08:35:26 +02:00
parent 09a1086558
commit f9a54ae552

View File

@@ -677,7 +677,7 @@ class Pane extends Model
true
handleSaveError: (error) ->
if error.code is 'EISDIR' or error.message.endsWith('is a directory')
if error.code is 'EISDIR' or error.message?.endsWith('is a directory')
atom.notifications.addWarning("Unable to save file: #{error.message}")
else if error.code is 'EACCES' and error.path?
atom.notifications.addWarning("Unable to save file: Permission denied '#{error.path}'")