Index: src/pdf/SkPDFTypes.cpp |
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp |
index afb9b72c545cc0d8e523da07e647cb9a029bd72b..6bf6afc6113399aba7bb9b4908549597bd83199c 100644 |
--- a/src/pdf/SkPDFTypes.cpp |
+++ b/src/pdf/SkPDFTypes.cpp |
@@ -573,7 +573,9 @@ void SkPDFStream::setData(std::unique_ptr<SkStreamAsset> stream) { |
SkASSERT(stream->hasLength()); |
SkDynamicMemoryWStream compressedData; |
SkDeflateWStream deflateWStream(&compressedData); |
- SkStreamCopy(&deflateWStream, stream.get()); |
+ if (stream->getLength() > 0) { |
+ SkStreamCopy(&deflateWStream, stream.get()); |
+ } |
deflateWStream.finalize(); |
size_t compressedLength = compressedData.bytesWritten(); |
size_t originalLength = stream->getLength(); |