summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/pdfium_test.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index e4a55f27ff..52e0125f09 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -518,6 +518,12 @@ void RenderPdf(const std::string& name, const char* pBuf, size_t len,
int height = static_cast<int>(FPDF_GetPageHeight(page) * scale);
FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0);
+ if (!bitmap) {
+ fprintf(stderr, "Page was too large to be rendered.\n");
+ bad_pages++;
+ continue;
+ }
+
FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF);
FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0);
rendered_pages ++;