| Index: gm/image_pict.cpp
|
| diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
|
| index fd7ac2adb12089efffa2b6619a8c4b5ae6f8d6c4..9d1dc513a8cbd74eba522595d90cc5937f12a2a8 100644
|
| --- a/gm/image_pict.cpp
|
| +++ b/gm/image_pict.cpp
|
| @@ -212,11 +212,13 @@ public:
|
| , fCtx(SkRef(ctx))
|
| {
|
| auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
|
| - surface->getCanvas()->clear(0);
|
| - surface->getCanvas()->translate(-100, -100);
|
| - surface->getCanvas()->drawPicture(pic);
|
| - sk_sp<SkImage> image(surface->makeImageSnapshot());
|
| - fTexture.reset(SkRef(as_IB(image)->peekTexture()));
|
| + if (surface) {
|
| + surface->getCanvas()->clear(0);
|
| + surface->getCanvas()->translate(-100, -100);
|
| + surface->getCanvas()->drawPicture(pic);
|
| + sk_sp<SkImage> image(surface->makeImageSnapshot());
|
| + fTexture.reset(SkRef(as_IB(image)->peekTexture()));
|
| + }
|
| }
|
| protected:
|
| GrTexture* onGenerateTexture(GrContext* ctx, const SkIRect* subset) override {
|
| @@ -224,6 +226,10 @@ protected:
|
| SkASSERT(ctx == fCtx.get());
|
| }
|
|
|
| + if (!fTexture) {
|
| + return nullptr;
|
| + }
|
| +
|
| if (!subset) {
|
| return SkRef(fTexture.get());
|
| }
|
|
|