🍎 fix #3864 where saving a file causes a crash if file extension array is empty

This commit is contained in:
leethomas 2015-12-30 12:38:02 -08:00
parent d4de4505b8
commit ba26a4b4e6

View file

@ -34,7 +34,12 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
[file_type_set addObject:base::mac::CFToNSCast(ext_cf.get())]; [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, void SetupDialog(NSSavePanel* dialog,