 
   openSelectedEntry: (options={}, expandDirectory=false) ->
     selectedEntry = @selectedEntry()
+    return unless selectedEntry?
+
     if selectedEntry.classList.contains('directory')
       if expandDirectory
         @expandDirectory(false)


  openSelectedEntryInPane: (index) ->
    selectedEntry = @selectedEntry()
    pane = atom.workspace.getPanes()[index]
    if pane and selectedEntry.classList.contains('file')
      atom.workspace.openURIInPane selectedEntry.getPath(), pane


  expandDirectory: (isRecursive=false) ->
    selectedEntry = @selectedEntry()
    return unless selectedEntry?

    if isRecursive is false and selectedEntry.isExpanded
      @moveDown() if selectedEntry.directory.getEntries().length > 0
    else
