Index: src/gpu/SkGr.cpp |
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp |
index 18c54ef3c251175ba7a9769035b32259c65d770c..c7ae0c8f36684f398043329a4b75e2f0b1bf9e72 100644 |
--- a/src/gpu/SkGr.cpp |
+++ b/src/gpu/SkGr.cpp |
@@ -141,7 +141,9 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx, |
GrResourceKey key; |
GrTexture* result = ctx->createTexture(params, desc, cacheID, |
storage.get(), bitmap->width(), &key); |
- add_genID_listener(key, origBitmap.pixelRef()); |
+ if (NULL != result) { |
+ add_genID_listener(key, origBitmap.pixelRef()); |
+ } |
return result; |
} else { |
GrTexture* result = ctx->lockAndRefScratchTexture(desc, |
@@ -171,7 +173,9 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx, |
GrResourceKey key; |
GrTexture* result = ctx->createTexture(params, desc, cacheID, |
bitmap->getPixels(), bitmap->rowBytes(), &key); |
- add_genID_listener(key, origBitmap.pixelRef()); |
+ if (NULL != result) { |
+ add_genID_listener(key, origBitmap.pixelRef()); |
+ } |
return result; |
} else { |
// This texture is unlikely to be used again (in its present form) so |