summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-21 23:36:32 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-21 23:36:32 +0000
commit7164f02096ab8d27df396c2e3b00fa5b638b41b4 (patch)
tree25b2760426bff0dc578f75efaa0db43a7a0790fa /chrome
parentbb435b3b576004b83dd8ccd064052ba88cbac271 (diff)
downloadchromium_src-7164f02096ab8d27df396c2e3b00fa5b638b41b4.zip
chromium_src-7164f02096ab8d27df396c2e3b00fa5b638b41b4.tar.gz
chromium_src-7164f02096ab8d27df396c2e3b00fa5b638b41b4.tar.bz2
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
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/dom_ui/dom_ui_theme_source.cc6
1 files changed, 5 insertions, 1 deletions
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<unsigned char> png_bytes;
PNGEncoder::EncodeBGRASkBitmap(*image, false, &png_bytes);