 
     displayName : 'ProjectFiles-NoFiles'
 
+    getDefaultProps : ->
+        file_search : ''
+
     # Go to the new file tab if there is no file search
     handle_click : ->
-        if not @props.file_search?.length > 0
+        if @props.file_search.length == 0
             @props.actions.set_focused_page('project-new-file')
-        else if @props.file_search?[@props.file_search.length - 1] == '/'
+        else if @props.file_search[@props.file_search.length - 1] == '/'
             @props.create_folder()
         else
             @props.create_file()
 
     # Returns the full file_search text in addition to the default extension if applicable
     full_path_text : ->
-        if @props.file_search?.lastIndexOf('.') <= @props.file_search?.lastIndexOf('/')
+        if @props.file_search.lastIndexOf('.') <= @props.file_search.lastIndexOf('/')
           ext = "sagews"
         if ext and @props.file_search.slice(-1) isnt '/'
             "#{@props.file_search}.#{ext}"

        @props.actions.setState(page_number : @props.page_number + 1)

    create_file : (ext) ->
        if not ext? and @props.file_search?.lastIndexOf('.') <= @props.file_search?.lastIndexOf('/')
            ext = "sagews"
        @props.actions.create_file
            name         : @props.file_search


    # Text for the large create button
    button_text : ->
        if @props.file_search.length == 0
            "Create or upload files..."
        else
            "Create #{@full_path_text()}"
