     ed = atom.workspace.getActiveTextEditor()
     for sel in ed.getSelections()
       rs = @forLines ed, sel.getHeadBufferPosition().row, sel.getTailBufferPosition().row
+      continue unless rs?
       rs.map (r) -> r.toggleView()
 
   # Commands

  @all: -> # TODO: scope selector
    results = []
    for item in atom.workspace.getPaneItems() when atom.workspace.isTextEditor item
      item.findMarkers().filter((m) -> m.result?).forEach (m) ->
        results.push m.result
    results


      result.invalidate()

  @forLines: (ed, start, end, type = 'any') ->
    layers[ed.id]?.findMarkers(intersectsBufferRowRange: [start, end])
                  .filter((m) -> (m.result.type == type || type == 'any'))
                  .map((m) -> m.result)

  @removeLines: (ed, start, end, type = 'any') ->
    rs = @forLines(ed, start, end, type)
    return unless rs?
    rs.map (r) -> r.remove()
    rs.length > 0

  @removeAll: (ed = atom.workspace.getActiveTextEditor()) ->
    layers[ed.id]?.getMarkers().map((m) -> m.result.remove())

  @removeCurrent: (e) ->
    if (ed = atom.workspace.getActiveTextEditor())
