 
   subscribeToBuffer: ->
     @unsubscribeFromBuffer()
-    if @buffer = @pane.activeItem.getBuffer?()
+    if @buffer = @pane.activeItem?.getBuffer?()
       @buffer.on 'modified-status-changed', @updateBufferHasModifiedText
       @buffer.on 'saved', @updateStatusBar
 

    @updateCursorPositionText()

  updateGrammarText: ->
    grammar = @pane.activeView.getGrammar?()
    if grammar?
      if grammar is syntax.nullGrammar
        grammarName = 'Plain Text'

  updatePathText: ->
    if path = @getActiveItemPath()
      @currentPath.text(project.relativize(path)).show()
    else if title = @pane.activeItem?.getTitle?()
      @currentPath.text(title).show()
    else
      @currentPath.hide()

  updateCursorPositionText: ->
    if position = @pane.activeView?.getCursorBufferPosition?()
      @cursorPosition.text("#{position.row + 1},#{position.column + 1}").show()
    else
      @cursorPosition.hide()
