[poppler] qt4/src

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Dec 22 05:32:12 PST 2007


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

New commits:
commit 40551e616b007ceb15c9d6e3d77c24538ffec924
Author: Albert Astals Cid <tsdgeos at bluebox.localdomain>
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;
 	}


More information about the poppler mailing list