 
     handleCapture = ({target}) ->
       return unless shouldSaveLocation(target)
-      activeEditor = atom.workspace.getActiveTextEditor()
-      oldLocation = getLocation('mousedown', activeEditor)
+      return unless editor = atom.workspace.getActiveTextEditor()
+      oldLocation = getLocation('mousedown', editor)
       locationStack.push oldLocation
 
     handleBubble = ({target}) =>

  deactivate: ->
    @subscriptions.dispose()
    @subscriptions = null
    @editorSubscriptions.dispose()
    @editorSubscriptions = null
    settings.dispose()
    @history?.destroy()
    @history = null

  config: settings.config
  history: null
  subscriptions: null

  activate: ->
    @subscriptions = new CompositeDisposable
    @history = new History(settings.get('max'))
    @emitter = new Emitter

