 
     # Go to new file tab if no file is specified
     on_create_button_clicked : ->
-        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()


    displayName : 'ProjectFiles-NoFiles'

    # Go to the new file tab if there is no file search
    handle_click : ->
        if not @props.file_search?.length > 0
            @props.actions.set_focused_page('project-new-file')
        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('/')
          ext = "sagews"
        if ext and @props.file_search.slice(-1) isnt '/'
            "#{@props.file_search}.#{ext}"


    getDefaultProps : ->
        page_number : 0
        file_search : ''

    previous_page : ->
        if @props.page_number > 0
