Index: src/core/SkDevice.cpp |
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp |
index dd55aad0ce42379d502fa5f6b6e573114ad983d8..b2cc0ddbc3551cafa4fa1f95bcc4559f97bbcc52 100644 |
--- a/src/core/SkDevice.cpp |
+++ b/src/core/SkDevice.cpp |
@@ -198,8 +198,14 @@ void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR |
localM.preTranslate(-tex[i].left(), -tex[i].top()); |
SkPaint pnt(paint); |
- pnt.setShader(atlas->newShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, |
- &localM))->unref(); |
+ SkAutoTUnref<SkShader> shader(atlas->newShader(SkShader::kClamp_TileMode, |
+ SkShader::kClamp_TileMode, |
+ &localM)); |
+ if (!shader) { |
+ break; |
+ } |
+ pnt.setShader(shader); |
+ |
if (colors && colors[i] != SK_ColorWHITE) { |
SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(colors[i], mode)); |
pnt.setColorFilter(cf); |