qt4/src/poppler-link.cc |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 40551e616b007ceb15c9d6e3d77c24538ffec924
Author: Albert Astals Cid <[EMAIL PROTECTED]>
Date:   Sat Dec 22 14:31:50 2007 +0100

    Check the destination page of the link does exist

diff --git a/qt4/src/poppler-link.cc b/qt4/src/poppler-link.cc
index 22c9ec3..4d407a3 100644
--- a/qt4/src/poppler-link.cc
+++ b/qt4/src/poppler-link.cc
@@ -210,14 +210,18 @@ class LinkMoviePrivate : public LinkPrivate
                
                int leftAux = 0, topAux = 0, rightAux = 0, bottomAux = 0;
                
-               ::Page *page = data.doc->doc->getCatalog()->getPage( d->pageNum 
);
-               cvtUserToDev( page, left, top, &leftAux, &topAux );
-               cvtUserToDev( page, right, bottom, &rightAux, &bottomAux );
-               
-               d->left = leftAux / (double)page->getCropWidth();
-               d->top = topAux / (double)page->getCropHeight();
-               d->right = rightAux/ (double)page->getCropWidth();
-               d->bottom = bottomAux / (double)page->getCropHeight();
+               if (d->pageNum > 0 && d->pageNum <= 
data.doc->doc->getNumPages())
+               {
+                       ::Page *page = data.doc->doc->getCatalog()->getPage( 
d->pageNum );
+                       cvtUserToDev( page, left, top, &leftAux, &topAux );
+                       cvtUserToDev( page, right, bottom, &rightAux, 
&bottomAux );
+                       
+                       d->left = leftAux / (double)page->getCropWidth();
+                       d->top = topAux / (double)page->getCropHeight();
+                       d->right = rightAux/ (double)page->getCropWidth();
+                       d->bottom = bottomAux / (double)page->getCropHeight();
+               }
+               else d->pageNum = 0;
                
                if (deleteDest) delete ld;
        }
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to