Revision: 10203
          http://sourceforge.net/p/skim-app/code/10203
Author:   hofman
Date:     2018-12-29 15:08:58 +0000 (Sat, 29 Dec 2018)
Log Message:
-----------
only reload page popup when it is present

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

Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m  2018-12-29 14:07:34 UTC (rev 10202)
+++ trunk/SKSecondaryPDFView.m  2018-12-29 15:08:58 UTC (rev 10203)
@@ -150,32 +150,34 @@
 }
 
 - (void)reloadPagePopUpButton {
-    NSArray *labels = [[self document] pageLabels];
-    NSUInteger count = [pagePopUpButton numberOfItems];
-    NSSize size = NSMakeSize(1000.0, 1000.0);
-    NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:[pagePopUpButton font], NSFontAttributeName, nil];
-    __block CGFloat maxWidth = 0.0;
-    __block NSUInteger maxIndex = 0;
-    
-    while (count--)
-        [pagePopUpButton removeItemAtIndex:count];
-    
-    if ([labels count] > 0) {
-        [labels enumerateObjectsUsingBlock:^(id label, NSUInteger i, BOOL 
*stop) {
-            CGFloat width = NSWidth([label boundingRectWithSize:size options:0 
attributes:attrs]);
-            if (width > maxWidth) {
-                maxWidth = width;
-                maxIndex = i;
-            }
-            [pagePopUpButton addItemWithTitle:label];
-        }];
+    if (pagePopUpButton) {
+        NSArray *labels = [[self document] pageLabels];
+        NSUInteger count = [pagePopUpButton numberOfItems];
+        NSSize size = NSMakeSize(1000.0, 1000.0);
+        NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:[pagePopUpButton font], NSFontAttributeName, nil];
+        __block CGFloat maxWidth = 0.0;
+        __block NSUInteger maxIndex = 0;
         
-        sizePopUpToItemAtIndex(pagePopUpButton, maxIndex);
+        while (count--)
+            [pagePopUpButton removeItemAtIndex:count];
         
-        [pagePopUpButton selectItemAtIndex:[[self currentPage] pageIndex]];
-        
-        if (controlView)
-            [controlView setFrameSize:NSMakeSize(NSWidth([toolModeButton 
frame]) + NSWidth([pagePopUpButton frame]) + NSWidth([scalePopUpButton frame]), 
NSHeight([controlView frame]))];
+        if ([labels count] > 0) {
+            [labels enumerateObjectsUsingBlock:^(id label, NSUInteger i, BOOL 
*stop) {
+                CGFloat width = NSWidth([label boundingRectWithSize:size 
options:0 attributes:attrs]);
+                if (width > maxWidth) {
+                    maxWidth = width;
+                    maxIndex = i;
+                }
+                [pagePopUpButton addItemWithTitle:label];
+            }];
+            
+            sizePopUpToItemAtIndex(pagePopUpButton, maxIndex);
+            
+            [pagePopUpButton selectItemAtIndex:[[self currentPage] pageIndex]];
+            
+            if (controlView)
+                [controlView setFrameSize:NSMakeSize(NSWidth([toolModeButton 
frame]) + NSWidth([pagePopUpButton frame]) + NSWidth([scalePopUpButton frame]), 
NSHeight([controlView frame]))];
+        }
     }
 }
 

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to