summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/hung_renderer_controller.mm
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-26 22:44:51 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-26 22:44:51 +0000
commit62ec236774d20534069231cab2b98e97691b90aa (patch)
tree4f7c03a2547e1ad32b9288b949847d9732129842 /chrome/browser/cocoa/hung_renderer_controller.mm
parentc76a36aedc05644574b98cf81ee8a4c47bc90d24 (diff)
downloadchromium_src-62ec236774d20534069231cab2b98e97691b90aa.zip
chromium_src-62ec236774d20534069231cab2b98e97691b90aa.tar.gz
chromium_src-62ec236774d20534069231cab2b98e97691b90aa.tar.bz2
[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
Diffstat (limited to 'chrome/browser/cocoa/hung_renderer_controller.mm')
-rw-r--r--chrome/browser/cocoa/hung_renderer_controller.mm11
1 files changed, 10 insertions, 1 deletions
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]);