[poppler] qt4/tests

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Sep 1 11:29:57 PDT 2008


 qt4/tests/test-poppler-qt4.cpp |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit bb7996eaaad6a70404891bb2ff530160737ea3d7
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Sep 1 20:29:25 2008 +0200

    Do not crash on documents with no pages

diff --git a/qt4/tests/test-poppler-qt4.cpp b/qt4/tests/test-poppler-qt4.cpp
index 0f868b4..9b92d05 100644
--- a/qt4/tests/test-poppler-qt4.cpp
+++ b/qt4/tests/test-poppler-qt4.cpp
@@ -193,6 +193,12 @@ int main( int argc, char **argv )
         qDebug() << "No embedded files";
     }
 
+    if (doc->numPages() <= 0)
+    {
+        delete doc;
+        qDebug() << "Doc has no pages";
+        return 0;
+    }
 
     Poppler::Page *page = doc->page(0);
     qDebug() << "Page 1 size: " << page->pageSize().width()/72 << "inches x " << page->pageSize().height()/72 << "inches";


More information about the poppler mailing list