From 7164f02096ab8d27df396c2e3b00fa5b638b41b4 Mon Sep 17 00:00:00 2001 From: "glen@chromium.org" Date: Tue, 21 Jul 2009 23:36:32 +0000 Subject: Sometimes it's possible for a DOMUI to request images that don't exist (theme provider could specify null, or no custom image is provided). Move DCHECK protection into real code. BUG=17257 TEST=Run purify as described in bug. Review URL: http://codereview.chromium.org/159146 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21232 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/dom_ui/dom_ui_theme_source.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chrome') diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.cc b/chrome/browser/dom_ui/dom_ui_theme_source.cc index d98c313..2ce9cf5 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source.cc +++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc @@ -148,7 +148,11 @@ void DOMUIThemeSource::SendThemeBitmap(int request_id, int resource_id) { DCHECK(tp); SkBitmap* image = tp->GetBitmapNamed(resource_id); - DCHECK(image); + if (!image || image->empty()) { + SendResponse(request_id, NULL); + return; + } + std::vector png_bytes; PNGEncoder::EncodeBGRASkBitmap(*image, false, &png_bytes); -- cgit v1.1