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