Revision: 29149
          http://sourceforge.net/p/bibdesk/svn/29149
Author:   hofman
Date:     2025-04-20 15:52:50 +0000 (Sun, 20 Apr 2025)
Log Message:
-----------
Check whether dataSource responds to subTitleAtIndex before getting the 
implemwntation, documentation says we should not do this if it is not a valid 
selector

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2025-04-20 
15:32:57 UTC (rev 29148)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2025-04-20 
15:52:50 UTC (rev 29149)
@@ -1886,8 +1886,9 @@
     
     // datasource subtitle method; may result in a NULL IMP (in which case 
_orderedSubtitles is nil)
     SEL subtitleSel = @selector(fileView:subtitleAtIndex:);
-    id (*subtitleAtIndex)(id, SEL, id, NSUInteger);
-    subtitleAtIndex = (id (*)(id, SEL, id, NSUInteger))[(id)_dataSource 
methodForSelector:subtitleSel];
+    id (*subtitleAtIndex)(id, SEL, id, NSUInteger) = NULL;
+    if ([(id)_dataSource respondsToSelector:subtitleSel])
+        subtitleAtIndex = (id (*)(id, SEL, id, NSUInteger))[(id)_dataSource 
methodForSelector:subtitleSel];
     
     NSUInteger i, iMax = isBound ? [_orderedURLs count] : [_dataSource 
numberOfURLsInFileView:self];
     
@@ -1901,7 +1902,7 @@
         if (NO == isBound)
             insertObjectAtIndex(_orderedURLs, insertSel, aURL, i);
         insertObjectAtIndex(_orderedIcons, insertSel, icon, i);
-        if (_orderedSubtitles)
+        if (_orderedSubtitles && subtitleAtIndex)
             insertObjectAtIndex(_orderedSubtitles, insertSel, 
subtitleAtIndex(_dataSource, subtitleSel, self, i), i);
     }
     

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