Index: chrome/browser/media_gallery/media_file_system_registry.cc |
diff --git a/chrome/browser/media_gallery/media_file_system_registry.cc b/chrome/browser/media_gallery/media_file_system_registry.cc |
index 33b9ac51fa92b5626f1f5fbb59533efe646bbc55..c297a4d949a177cddbfcffe2019482bef9d5a5e8 100644 |
--- a/chrome/browser/media_gallery/media_file_system_registry.cc |
+++ b/chrome/browser/media_gallery/media_file_system_registry.cc |
@@ -469,17 +469,19 @@ void MediaFileSystemRegistry::GetMediaFileSystemsForExtension( |
AddAttachedMediaDeviceGalleries(preferences); |
MediaGalleryPrefIdSet galleries = |
preferences->GalleriesForExtension(*extension); |
- ExtensionGalleriesHost* extension_host = |
- extension_hosts_map_[profile][extension->id()].get(); |
// If the extension has no galleries and it didn't have any last time, just |
// return the empty list. The second check is needed because of |
// http://crbug.com/145855. |
- if (galleries.empty() && !extension_host) { |
+ bool has_extension_host = ContainsKey(extension_hosts_map_, profile) && |
+ ContainsKey(extension_hosts_map_[profile], extension->id()); |
+ if (galleries.empty() && !has_extension_host) { |
callback.Run(std::vector<MediaFileSystemInfo>()); |
return; |
} |
+ ExtensionGalleriesHost* extension_host = |
+ extension_hosts_map_[profile][extension->id()].get(); |
if (!extension_host) { |
extension_host = new ExtensionGalleriesHost( |
file_system_context_.get(), |