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

Unified Diff: chrome/browser/icon_loader_win.cc

Issue 7753009: In icon_loader_win.cc, if CreateSkBitmapFromHICON fails, don't pass NULL to gfx::Image and crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/icon_loader_win.cc
diff --git a/chrome/browser/icon_loader_win.cc b/chrome/browser/icon_loader_win.cc
index eeeedb0efe654fb89e256936379a5e7451075f31..b0b39f4022853f7f9f63ca8b7b6ba0110a387753 100644
--- a/chrome/browser/icon_loader_win.cc
+++ b/chrome/browser/icon_loader_win.cc
@@ -42,8 +42,15 @@ void IconLoader::ReadIcon() {
DCHECK(r);
gfx::Size icon_size(bitmap_info.bmWidth, bitmap_info.bmHeight);
- image_.reset(new gfx::Image(
- IconUtil::CreateSkBitmapFromHICON(file_info.hIcon, icon_size)));
+
+ const SkBitmap* bitmap =
+ IconUtil::CreateSkBitmapFromHICON(file_info.hIcon, icon_size);
+ if (bitmap) {
+ image_.reset(new gfx::Image(bitmap));
+ } else {
+ LOG(ERROR) << "Decoding HICON for group " << group_ << " failed";
Peter Kasting 2011/08/26 19:52:56 Nit: TBH, I'm not sure how much use this error log
+ image_.reset();
+ }
target_message_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &IconLoader::NotifyDelegate));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698