Revision: 15456
          http://sourceforge.net/p/skim-app/code/15456
Author:   hofman
Date:     2025-06-13 17:21:27 +0000 (Fri, 13 Jun 2025)
Log Message:
-----------
don't try to expand leaf outline items

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2025-06-13 17:02:02 UTC (rev 15455)
+++ trunk/SKMainWindowController.m      2025-06-13 17:21:27 UTC (rev 15456)
@@ -795,18 +795,20 @@
     BOOL isExpanded = info ? [[info valueForKey:EXPANDED_KEY] boolValue] : 
level < 0 ? [anOutline isOpen] : level < 2;
     if (isExpanded && anOutline) {
         NSUInteger i, iMax = [anOutline numberOfChildren];
-        NSMutableArray *children = [[NSMutableArray alloc] init];
-        for (i = 0; i < iMax; i++)
-            [children addObject:[anOutline childAtIndex:i]];
-        if ([anOutline parent])
-            [leftSideController.tocOutlineView expandItem:anOutline];
-        if (level >= 0) ++level;
-        NSArray *childrenStates = [info valueForKey:CHILDREN_KEY];
-        NSEnumerator *infoEnum = nil;
-        if (childrenStates && [[children valueForKey:LABEL_KEY] 
isEqualToArray:[childrenStates valueForKey:LABEL_KEY]])
-            infoEnum = [childrenStates objectEnumerator];
-        for (PDFOutline *child in children)
-            [self expandOutline:child forExpansionState:[infoEnum nextObject] 
level:level];
+        if (iMax > 0) {
+            NSMutableArray *children = [[NSMutableArray alloc] init];
+            for (i = 0; i < iMax; i++)
+                [children addObject:[anOutline childAtIndex:i]];
+            if ([anOutline parent])
+                [leftSideController.tocOutlineView expandItem:anOutline];
+            if (level >= 0) ++level;
+            NSArray *childrenStates = [info valueForKey:CHILDREN_KEY];
+            NSEnumerator *infoEnum = nil;
+            if (childrenStates && [[children valueForKey:LABEL_KEY] 
isEqualToArray:[childrenStates valueForKey:LABEL_KEY]])
+                infoEnum = [childrenStates objectEnumerator];
+            for (PDFOutline *child in children)
+                [self expandOutline:child forExpansionState:[infoEnum 
nextObject] level:level];
+        }
     }
 }
 

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to