Revision: 29079
          http://sourceforge.net/p/bibdesk/svn/29079
Author:   hofman
Date:     2025-02-28 14:39:36 +0000 (Fri, 28 Feb 2025)
Log Message:
-----------
check for range inclusion before adapting range

Modified Paths:
--------------
    trunk/bibdesk/BibDocument+Scripting.m

Modified: trunk/bibdesk/BibDocument+Scripting.m
===================================================================
--- trunk/bibdesk/BibDocument+Scripting.m       2025-02-28 14:33:38 UTC (rev 
29078)
+++ trunk/bibdesk/BibDocument+Scripting.m       2025-02-28 14:39:36 UTC (rev 
29079)
@@ -798,11 +798,11 @@
         if (rangeStartIndex == NSNotFound || rangeEndIndex == NSNotFound)
             // Oops.  We couldn't find the range objects in the groups array.  
This should not happen.
             return nil;
+        if (startIndex > rangeEndIndex || endIndex < rangeStartIndex)
+            // The requested range does not include any of the requested type 
of groups.
+            return @[];
         startIndex = MAX(startIndex, rangeStartIndex);
         endIndex = MIN(endIndex, rangeEndIndex);
-        if (endIndex < startIndex)
-            // The requested range does not include any of the requested type 
of groups.
-            return @[];
     }
     
     return [allGroups subarrayWithRange:NSMakeRange(startIndex, endIndex + 1 - 
startIndex)];

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



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to