From 62ec236774d20534069231cab2b98e97691b90aa Mon Sep 17 00:00:00 2001 From: "rohitrao@chromium.org" Date: Tue, 26 Jan 2010 22:44:51 +0000 Subject: [Mac] Possibly prevent crashes by properly handling missing/invalid favicons in HungRendererController. BUG=33160 TEST=None. (No repro case. Hopefully crashes will go away.) Review URL: http://codereview.chromium.org/556022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37161 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/hung_renderer_controller.mm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'chrome/browser/cocoa/hung_renderer_controller.mm') diff --git a/chrome/browser/cocoa/hung_renderer_controller.mm b/chrome/browser/cocoa/hung_renderer_controller.mm index 7bc9105..db68bd1 100644 --- a/chrome/browser/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/cocoa/hung_renderer_controller.mm @@ -19,6 +19,7 @@ #include "chrome/common/logging_chrome.h" #include "chrome/common/result_codes.h" #include "grit/chromium_strings.h" +#include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "skia/ext/skia_utils_mac.h" @@ -142,8 +143,16 @@ HungRendererController* g_instance = NULL; } else { [titles addObject:base::SysUTF16ToNSString(title)]; } - [favicons addObject:gfx::SkBitmapToNSImage(it->GetFavIcon())]; + // TabContents can return a null SkBitmap if it has no favicon. If this + // happens, use the default favicon. + const SkBitmap& bitmap = it->GetFavIcon(); + if (!bitmap.isNull()) { + [favicons addObject:gfx::SkBitmapToNSImage(bitmap)]; + } else { + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + [favicons addObject:rb.GetNSImageNamed(IDR_DEFAULT_FAVICON)]; + } } } hungTitles_.reset([titles copy]); -- cgit v1.1