Index: src/image/SkImage_Gpu.cpp |
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp |
index 6655e39c17d400963708767639e3981df22b1fc0..fdcb87136db528f79b666ff8e39ac0ee6dbcba9a 100644 |
--- a/src/image/SkImage_Gpu.cpp |
+++ b/src/image/SkImage_Gpu.cpp |
@@ -254,7 +254,11 @@ SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorS |
const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), |
SkIntToScalar(dstDesc.fHeight)); |
- GrDrawContext* drawContext = ctx->drawContext(); |
+ SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext()); |
+ if (!drawContext) { |
+ return nullptr; |
+ } |
+ |
drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMatrix::I(), rect); |
ctx->flushSurfaceWrites(dst); |
return new SkImage_Gpu(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImageUniqueID, |