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

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..09e6513824d23003dab7534eebe2d1eec6009112 100644
--- a/chrome/browser/icon_loader_win.cc
+++ b/chrome/browser/icon_loader_win.cc
@@ -42,9 +42,16 @@ 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) {
+ LOG(ERROR) << "Decoding HICON for group " << group_ << " failed";
+ // Don't create a gfx::Image and crash. The delegate won't be notified.
Peter Kasting 2011/08/26 18:12:56 Should we instead set |image_| to a non-NULL but z
Robert Sesek 2011/08/26 19:38:28 No, we should actually notify with a NULL pointer,
+ return;
+ }
+
+ image_.reset(new gfx::Image(bitmap));
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