Fix bug 65780:	Can't select file on mac with Accept parameter of <input type=file />

BUG=65780
TEST=Manual test

Review URL: http://codereview.chromium.org/5859007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69485 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc
index a1b31cd..1604b0de 100644
--- a/chrome/browser/file_select_helper.cc
+++ b/chrome/browser/file_select_helper.cc
@@ -166,6 +166,10 @@
       valid_type_count++;
   }
 
+  // If no valid extension is added, bail out.
+  if (valid_type_count == 0)
+    return NULL;
+
   // Use a generic description "Custom Files" if either of the following is
   // true:
   // 1) There're multiple types specified, like "audio/*,video/*"
@@ -227,7 +231,7 @@
                                   params.title,
                                   default_file_name,
                                   file_types.get(),
-                                  0,
+                                  file_types.get() ? 1 : 0,  // 1-based index.
                                   FILE_PATH_LITERAL(""),
                                   owning_window,
                                   NULL);