Index: tools/fiddle/fiddle_main.cpp |
diff --git a/tools/fiddle/fiddle_main.cpp b/tools/fiddle/fiddle_main.cpp |
index bf6a8c27d5fae86f43a0b8bd46626d7a1e694449..0fa61586663073835e4317a9649d227d3d393089 100644 |
--- a/tools/fiddle/fiddle_main.cpp |
+++ b/tools/fiddle/fiddle_main.cpp |
@@ -136,10 +136,12 @@ int main() { |
if (options.pdf) { |
SkDynamicMemoryWStream pdfStream; |
sk_sp<SkDocument> document(SkDocument::MakePDF(&pdfStream)); |
- srand(0); |
- draw(document->beginPage(options.size.width(), options.size.height())); |
- document->close(); |
- pdfData.reset(pdfStream.copyToData()); |
+ if (document) { |
+ srand(0); |
+ draw(document->beginPage(options.size.width(), options.size.height())); |
+ document->close(); |
+ pdfData.reset(pdfStream.copyToData()); |
+ } |
} |
if (options.skp) { |
SkSize size; |