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

Unified Diff: chrome/browser/media/tab_desktop_media_list.cc

Issue 2240823003: Avoid a crash in ProfileManager::GetLastUsedProfileAllowedByPolicy() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: schedule next refresh Created 4 years, 4 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 | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/tab_desktop_media_list.cc
diff --git a/chrome/browser/media/tab_desktop_media_list.cc b/chrome/browser/media/tab_desktop_media_list.cc
index 76a1bb839512bbec99851123f95a128613097068..911171613ec57a6da263c5a51295ebe22f83ee8e 100644
--- a/chrome/browser/media/tab_desktop_media_list.cc
+++ b/chrome/browser/media/tab_desktop_media_list.cc
@@ -73,6 +73,11 @@ void TabDesktopMediaList::Refresh() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Profile* profile = ProfileManager::GetLastUsedProfileAllowedByPolicy();
+ if (!profile) {
+ ScheduleNextRefresh();
+ return;
+ }
+
std::vector<Browser*> browsers;
for (auto* browser : *BrowserList::GetInstance()) {
if (browser->profile()->GetOriginalProfile() ==
@@ -130,9 +135,9 @@ void TabDesktopMediaList::Refresh() {
favicon_hashes_ = new_favicon_hashes;
// Sort tab sources by time. Most recent one first. Then update sources list.
- for (auto it = tab_map.rbegin(); it != tab_map.rend(); ++it) {
+ for (auto it = tab_map.rbegin(); it != tab_map.rend(); ++it)
sources.push_back(it->second);
- }
+
UpdateSourcesList(sources);
for (const auto& it : favicon_pairs) {
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698