Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: ui/shell_dialogs/select_file_dialog_mac.mm

Issue 2164223003: Mac File Dialogs: Fix crash due to adding nil value to an NSMutableSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/shell_dialogs/select_file_dialog_mac.mm
diff --git a/ui/shell_dialogs/select_file_dialog_mac.mm b/ui/shell_dialogs/select_file_dialog_mac.mm
index 1ac812236305e9eb72ef14efe0f4069354f70c1e..bf5a862562609991148364ac8a6bde4d753916d9 100644
--- a/ui/shell_dialogs/select_file_dialog_mac.mm
+++ b/ui/shell_dialogs/select_file_dialog_mac.mm
@@ -310,8 +310,11 @@ - (void)popupAction:(id)sender;
if (ext == default_extension)
default_extension_index = i;
+ // Crash reports suggest that CreateUTIFromExtension may return nil. Hence
+ // we nil check before adding to |file_type_set|. See crbug.com/630101.
base::ScopedCFTypeRef<CFStringRef> uti(CreateUTIFromExtension(ext));
- [file_type_set addObject:base::mac::CFToNSCast(uti.get())];
+ if (uti)
+ [file_type_set addObject:base::mac::CFToNSCast(uti.get())];
// Always allow the extension itself, in case the UTI doesn't map
// back to the original extension correctly. This occurs with dynamic
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698