Revision: 5731
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5731&view=rev
Author:   hofman
Date:     2009-09-09 17:07:30 +0000 (Wed, 09 Sep 2009)

Log Message:
-----------
check range for page index from synctex before using it

Modified Paths:
--------------
    trunk/SKMainDocument.m

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2009-09-09 17:00:55 UTC (rev 5730)
+++ trunk/SKMainDocument.m      2009-09-09 17:07:30 UTC (rev 5731)
@@ -1608,12 +1608,15 @@
 }
 
 - (void)synchronizer:(SKPDFSynchronizer *)synchronizer 
foundLocation:(NSPoint)point atPageIndex:(NSUInteger)pageIndex 
options:(NSInteger)options {
-    PDFPage *page = [[self pdfDocument] pageAtIndex:pageIndex];
-    if (options & SKPDFSynchronizerFlippedMask)
-        point.y = NSMaxY([page boundsForBox:kPDFDisplayBoxMediaBox]) - point.y;
-    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKShouldHighlightSearchResultsKey])
-        [[self mainWindowController] addTemporaryAnnotationForPoint:point 
onPage:page];
-    [[self pdfView] displayLineAtPoint:point inPageAtIndex:pageIndex 
showReadingBar:(options & SKPDFSynchronizerShowReadingBarMask) != 0];
+    PDFDocument *pdfDoc = [self pdfDocument];
+    if (pageIndex < [pdfDoc pageCount]) {
+        PDFPage *page = [pdfDoc pageAtIndex:pageIndex];
+        if (options & SKPDFSynchronizerFlippedMask)
+            point.y = NSMaxY([page boundsForBox:kPDFDisplayBoxMediaBox]) - 
point.y;
+        if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKShouldHighlightSearchResultsKey])
+            [[self mainWindowController] addTemporaryAnnotationForPoint:point 
onPage:page];
+        [[self pdfView] displayLineAtPoint:point inPageAtIndex:pageIndex 
showReadingBar:(options & SKPDFSynchronizerShowReadingBarMask) != 0];
+    }
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to