Protect from exceptions when attaching editor views w/ dead editors

Addresses #1306

We still need to know why this is happening, so I left an exception in
non-release builds. Since the pane system is about to change a lot I
think this is good enough for now.
This commit is contained in:
Nathan Sobo 2013-12-12 15:56:44 -08:00
parent e1d35ed90f
commit 75cee638bc

View File

@ -780,6 +780,14 @@ class EditorView extends View
afterAttach: (onDom) ->
return unless onDom
# TODO: Remove this guard when we understand why this is happening
unless @editor.isAlive()
if atom.isReleasedVersion()
return
else
throw new Error("Assertion failure: EditorView is getting attached to a dead editor. Why?")
@redraw() if @redrawOnReattach
return if @attached
@attached = true