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

Unified Diff: chrome/browser/media_gallery/media_file_system_registry.cc

Issue 11188015: Fix crash in media galleries on device removal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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: 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(),
« 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