     disposable = pane.onDidChangeActiveItem ->
       activeItem = pane.getActiveItem()
       if activeItem != termView
-        return termView.term.constructor._textarea = null
+        if termView.term
+          termView.term.constructor._textarea = null
+        return
 
       process.nextTick ->
         termView.focus()

      splitter()

  newTerm: (forkPTY=true, rows=30, cols=80, title='tty') ->
    termView = @createTermView {forkPTY, rows, cols}
    pane = atom.workspace.getActivePane()
    model = Terminals.add {
      local: !!forkPTY,

        # but, it is the constructor instead of the instance!!!1 - probably to avoid having to bind this as a premature
        # optimization.
        atomPane = activeItem.parentsUntil("atom-pane").parent()[0]
        if termView.term
          termView.term.constructor._textarea = atomPane

    id = model.id
    termView.id = id
