summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@chromium.org>2015-10-27 12:38:36 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-27 19:39:36 +0000
commit76aca1e99edcfeadb8061ac15dbefee31c89ab7c (patch)
tree2e3244d52689d297c260348aad59d999ee5da7e0
parent7d08a858e440216d5d4127428e31adda2d73c2bf (diff)
downloadchromium_src-76aca1e99edcfeadb8061ac15dbefee31c89ab7c.zip
chromium_src-76aca1e99edcfeadb8061ac15dbefee31c89ab7c.tar.gz
chromium_src-76aca1e99edcfeadb8061ac15dbefee31c89ab7c.tar.bz2
NULL check the UI manager when getting displayed notifications
We can end up with a NULL notification UI manager here when the browser process is being shut down and another feature, in their shut down code, ends up creating a new storage partition. BUG=546745 Review URL: https://codereview.chromium.org/1409293004 Cr-Commit-Position: refs/heads/master@{#356370}
-rw-r--r--chrome/browser/notifications/platform_notification_service_impl.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc
index d6a4e2c..04734d1 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -338,8 +338,15 @@ bool PlatformNotificationServiceImpl::GetDisplayedPersistentNotifications(
if (!profile || profile->AsTestingProfile())
return false; // Tests will not have a message center.
+ // There may not be a notification ui manager when another feature erroneously
+ // instantiates a storage partition when the browser process is shutting down.
+ // TODO(peter): Remove in favor of a DCHECK when crbug.com/546745 is fixed.
+ NotificationUIManager* ui_manager = GetNotificationUIManager();
+ if (!ui_manager)
+ return false;
+
// TODO(peter): Filter for persistent notifications only.
- *displayed_notifications = GetNotificationUIManager()->GetAllIdsByProfile(
+ *displayed_notifications = ui_manager->GetAllIdsByProfile(
NotificationUIManager::GetProfileID(profile));
return true;