             else
                 if v != ""
                     entry.addClass(exclude); entry.removeClass(include)
-        if first and event.keyCode == 13
+        if first and event?.keyCode == 13
             # No matches at all, and user pressed enter -- maybe they want to create a file?
             @display_tab("project-new-file")
             @new_file_tab_input.val(search_box.val())

            if (event.metaKey or event.ctrlKey) and event.keyCode == 79
                @display_tab("project-editor")
                return false
            @update_file_search()

    clear_file_search: () =>
        @_file_search_box.val('')

            fullpath = entry.data('name')
            filename = misc.path_split(fullpath).tail
            if match(filename, entry.hasClass('project-directory-link'))
                if first and event?.keyCode == 13 # enter -- select first match (if any)
                    entry.click()
                    first = false
                if v != ""
