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

Unified Diff: chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm

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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/content_settings/content_setting_bubble_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm
diff --git a/chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm b/chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm
index 9cc016e4d7e6c39d1e678ed6b239a441664a0754..bf29af034c34290dcdc962f33d1a6c30419ec8db 100644
--- a/chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm
@@ -13,14 +13,12 @@ namespace mac {
NSImage* FaviconForTabContents(TabContents* contents) {
if (contents && contents->favicon_tab_helper()->FaviconIsValid()) {
- NSImage* image = contents->favicon_tab_helper()->GetFavicon().AsNSImage();
- // The |image| could be nil if the bitmap is null. In that case, fallback
- // to the default image.
- if (image) {
- return image;
- }
+ const gfx::Image& icon = contents->favicon_tab_helper()->GetFavicon();
+ if (!icon.IsEmpty())
+ return icon.ToNSImage();;
}
+ // Fall back to the default image.
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON);
}
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/content_settings/content_setting_bubble_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698