summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 22:43:55 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 22:43:55 +0000
commitb61236c6679615af0811d59d130c91397d8c6be7 (patch)
treedfcfe53c4445a577e81284dc505c235ce4e819df /chrome
parent004af1999e1af93ce408ff4c4057eb6e174a82bd (diff)
downloadchromium_src-b61236c6679615af0811d59d130c91397d8c6be7.zip
chromium_src-b61236c6679615af0811d59d130c91397d8c6be7.tar.gz
chromium_src-b61236c6679615af0811d59d130c91397d8c6be7.tar.bz2
The profile Source parameter of a BookmarkModelLoaded event can be null during testing.
MetricsService and WebContents weren't handling this case properly. Review URL: http://codereview.chromium.org/66007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13475 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/metrics/metrics_service.cc8
-rw-r--r--chrome/browser/tab_contents/web_contents.cc2
2 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 5fcdb3a..8e94e98 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -534,10 +534,12 @@ void MetricsService::Observe(NotificationType type,
*Details<AutocompleteLog>(details).ptr());
break;
- case NotificationType::BOOKMARK_MODEL_LOADED:
- LogBookmarks(Source<Profile>(source)->GetBookmarkModel());
+ case NotificationType::BOOKMARK_MODEL_LOADED: {
+ Profile* p = Source<Profile>(source).ptr();
+ if (p)
+ LogBookmarks(p->GetBookmarkModel());
break;
-
+ }
default:
NOTREACHED();
break;
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index dbe335b..eaf181e 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -1637,7 +1637,7 @@ void WebContents::Observe(NotificationType type,
// Somewhere, a URL has been starred.
// Ignore notifications for profiles other than our current one.
Profile* source_profile = Source<Profile>(source).ptr();
- if (!source_profile->IsSameProfile(profile()))
+ if (!source_profile || !source_profile->IsSameProfile(profile()))
return;
UpdateStarredStateForCurrentURL();