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

Unified Diff: chrome/browser/ui/browser.cc

Issue 10837215: exhibit 1: explicit null checks Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index daffdc378be00d603ae285b97a9bf9b89e2e390a..8cbf3721833f4af379c0454dbf93e4afdb5e28fe 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -559,8 +559,10 @@ SkBitmap Browser::GetCurrentPageIcon() const {
// |contents| can be NULL since GetCurrentPageIcon() is called by the window
// during the window's creation (before tabs have been added).
// TODO: Let this return a gfx::Image.
- return contents ?
- contents->favicon_tab_helper()->GetFavicon().AsBitmap() : SkBitmap();
+ if (!contents)
+ return SkBitmap();
+ const gfx::Image& icon = contents->favicon_tab_helper()->GetFavicon();
+ return icon.IsEmpty() ? SkBitmap() : *icon.ToSkBitmap();
}
string16 Browser::GetWindowTitleForCurrentTab() const {

Powered by Google App Engine
This is Rietveld 408576698