summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-29 04:16:40 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-29 04:16:40 +0000
commitefafddc023fdc08a9f28f5834326df9971336625 (patch)
tree349a4181d2956e485de0bdad3e7d9e2898d99381 /chrome/browser
parent5203e6009c150dc2d58e2d96bb54ecf8d9fcca18 (diff)
downloadchromium_src-efafddc023fdc08a9f28f5834326df9971336625.zip
chromium_src-efafddc023fdc08a9f28f5834326df9971336625.tar.gz
chromium_src-efafddc023fdc08a9f28f5834326df9971336625.tar.bz2
Add null pointer check. It appears some themes specify images that don't exist, and some newly added code handled that poorly, leading to crashes.
BUG=none TEST=none Review URL: http://codereview.chromium.org/160312 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_theme_provider.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc
index 907d4a6..9e6b9ec 100644
--- a/chrome/browser/browser_theme_provider.cc
+++ b/chrome/browser/browser_theme_provider.cc
@@ -794,15 +794,16 @@ SkBitmap* BrowserThemeProvider::GenerateBitmap(int id) {
int blur_amount = (HasCustomImage(id)) ? 1 : 5;
SkBitmap blurred =
skia::ImageOperations::CreateBlurredBitmap(*frame, blur_amount);
- SkBitmap* bg_tab =
- new SkBitmap(TintBitmap(blurred, TINT_BACKGROUND_TAB));
+ SkBitmap* bg_tab = new SkBitmap(TintBitmap(blurred, TINT_BACKGROUND_TAB));
// If they've provided a custom image, overlay it.
if (HasCustomImage(id)) {
SkBitmap* overlay = LoadThemeBitmap(id);
- SkCanvas canvas(*bg_tab);
- for (int x = 0; x < bg_tab->width(); x += overlay->width())
- canvas.drawBitmap(*overlay, static_cast<SkScalar>(x), 0, NULL);
+ if (overlay) {
+ SkCanvas canvas(*bg_tab);
+ for (int x = 0; x < bg_tab->width(); x += overlay->width())
+ canvas.drawBitmap(*overlay, static_cast<SkScalar>(x), 0, NULL);
+ }
}
image_cache_[id] = bg_tab;