         return directories
 
     submit_selected: (path_list) ->
-        @props.add_folders(path_list)
+        if path_list?
+            # If nothing is selected and the user clicks the button to "Add handout (etc)" then
+            # path_list is undefined, hence don't do this.
+            # (NOTE: I'm also going to make it so that button is disabled, which fits our
+            # UI guidelines, so there's two reasons that path_list is defined here.)
+            @props.add_folders(path_list)
         @clear_add_search()
 
     clear_add_search: ->


    clear_and_focus_search_input: ->
        @props.clear_search()
        @setState(selected_items:'')
        @refs.search_input.clear_and_focus_search_input()

    search_button: ->

        item_name        : 'result'

    getInitialState: ->
        selected_items : [] # currently selected options
        show_selector  : false

    shouldComponentUpdate: (newProps, newState) ->
        return newProps.search_results != @props.search_results or
            newProps.item_name != @props.item_name or
            newProps.is_searching != @props.is_searching or
            not underscore.isEqual(newState.selected_items, @state.selected_items)

    componentWillReceiveProps: (newProps) ->
        @setState
