]> khamidou — GitHub mirrors - electron.git/commitdiff
:apple: fix #3864 where saving a file causes a crash if file extension array is empty
authorleethomas <leet944@gmail.com>
Wed, 30 Dec 2015 20:38:02 +0000 (12:38 -0800)
committerleethomas <leet944@gmail.com>
Wed, 30 Dec 2015 21:26:38 +0000 (13:26 -0800)
atom/browser/ui/file_dialog_mac.mm

index 1cbe46e3b55b29dec971c082982e00918dfc095a..676c632a2a442d8bf8e43e28e804864b7f94fbd9 100644 (file)
@@ -34,7 +34,12 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
       [file_type_set addObject:base::mac::CFToNSCast(ext_cf.get())];
     }
   }
-  [dialog setAllowedFileTypes:[file_type_set allObjects]];
+
+  NSArray* file_types = nil;
+  if ([file_type_set count])
+    file_types = [file_type_set allObjects];
+
+  [dialog setAllowedFileTypes: file_types];
 }
 
 void SetupDialog(NSSavePanel* dialog,