Index: src/pdf/SkPDFImage.cpp |
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp |
index 122d2f214845dfcc111bdbe262b020ec219eeba5..73d85816aa7e070b4d022dcfe76af218597cf81a 100644 |
--- a/src/pdf/SkPDFImage.cpp |
+++ b/src/pdf/SkPDFImage.cpp |
@@ -222,7 +222,11 @@ static SkStream* extract_image_data(const SkBitmap& bitmap, |
bool transparent = extractAlpha; |
SkStream* stream = NULL; |
- bitmap.lockPixels(); |
+ SkAutoLockPixels lock(bitmap); |
+ if (NULL == bitmap.getPixels()) { |
+ return NULL; |
+ } |
+ |
switch (colorType) { |
case kIndex_8_SkColorType: |
if (!extractAlpha) { |
@@ -253,7 +257,6 @@ static SkStream* extract_image_data(const SkBitmap& bitmap, |
default: |
SkASSERT(false); |
} |
- bitmap.unlockPixels(); |
if (isTransparent != NULL) { |
*isTransparent = transparent; |