Blob Blame History Raw
diff -rupN podofo-0.9.6/tools/podofoimpose/pdftranslator.cpp podofo-0.9.6-new/tools/podofoimpose/pdftranslator.cpp
--- podofo-0.9.6/tools/podofoimpose/pdftranslator.cpp	2016-11-18 20:08:56.000000000 +0100
+++ podofo-0.9.6-new/tools/podofoimpose/pdftranslator.cpp	2019-03-13 23:15:12.323138702 +0100
@@ -256,7 +256,13 @@ namespace PoDoFo
 				PdfPage * page = sourceDoc->GetPage ( i );
 				PdfMemoryOutputStream outMemStream ( 1 );
 
-				PdfXObject *xobj = new PdfXObject ( page->GetMediaBox(), targetDoc );
+				if (!page) // Fix issue #32
+                {
+                    std::ostringstream oss;
+                    oss << "Page " << i << " (0-based) of " << pcount << " in source doc not found!";
+                    PODOFO_RAISE_ERROR_INFO( ePdfError_PageNotFound, oss.str() );
+                }
+                PdfXObject *xobj = new PdfXObject ( page->GetMediaBox(), targetDoc );
 				if ( page->GetContents()->HasStream() )
 				{
 					page->GetContents()->GetStream()->GetFilteredCopy ( &outMemStream );