76f8c5
commit ee4a389872d86b619c677888da8f13f1f6c54472
76f8c5
Author: Adrian Johnson <ajohnson@redneon.com>
76f8c5
Date:   Mon Oct 20 22:32:30 2014 +1030
76f8c5
76f8c5
    PDFDoc: fix crash when getPage() returns NULL
76f8c5
    
76f8c5
    Bug 85235
76f8c5
76f8c5
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
76f8c5
index d1b5d7b..8fd5e18 100644
76f8c5
--- a/poppler/PDFDoc.cc
76f8c5
+++ b/poppler/PDFDoc.cc
76f8c5
@@ -626,7 +626,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo)
76f8c5
   int keyLength;
76f8c5
   xref->getEncryptionParameters(&fileKey, &encAlgorithm, &keyLength);
76f8c5
 
76f8c5
-  if (pageNo < 1 || pageNo > getNumPages()) {
76f8c5
+  if (pageNo < 1 || pageNo > getNumPages() || !getCatalog()->getPage(pageNo)) {
76f8c5
     error(errInternal, -1, "Illegal pageNo: {0:d}({1:d})", pageNo, getNumPages() );
76f8c5
     return errOpenFile;
76f8c5
   }