Revision: 22770
          http://sourceforge.net/p/bibdesk/svn/22770
Author:   hofman
Date:     2018-10-08 17:06:34 +0000 (Mon, 08 Oct 2018)
Log Message:
-----------
make sure we have a publication to analyze

Modified Paths:
--------------
    trunk/bibdesk/BDSKParseFormatCommand.m

Modified: trunk/bibdesk/BDSKParseFormatCommand.m
===================================================================
--- trunk/bibdesk/BDSKParseFormatCommand.m      2018-10-08 16:58:16 UTC (rev 
22769)
+++ trunk/bibdesk/BDSKParseFormatCommand.m      2018-10-08 17:06:34 UTC (rev 
22770)
@@ -82,19 +82,23 @@
                 pub = [[spec containerSpecifier] objectsByEvaluatingSpecifier];
             else if ([[spec key] isEqualToString:@""] && [[[spec 
containerSpecifier] key] isEqualToString:@"linkedFiles"])
                 pub = [[[spec containerSpecifier] containerSpecifier] 
objectsByEvaluatingSpecifier];
-            field = BDSKLocalFileString;
-            i = [(NSIndexSpecifier *)spec index];
-            if (i < 0)
-                i += [[pub localFiles] count];
+            if ([pub isKindOfClass:[BibItem class]]) {
+                field = BDSKLocalFileString;
+                i = [(NSIndexSpecifier *)spec index];
+                if (i < 0)
+                    i += [[pub localFiles] count];
+            }
         } else if ([[spec key] isEqualToString:@"linkedFiles"]) {
             pub = [[spec containerSpecifier] objectsByEvaluatingSpecifier];
-            NSInteger count = -2, *indices = [spec 
indicesOfObjectsByEvaluatingWithContainer:pub count:&count];
-            if (count == 1)
-                i = indices[0];
-            else if (count == -1 && [[pub localFiles] count] == 1)
-                i = 0;
-            else
-                pub = nil;
+            if ([pub isKindOfClass:[BibItem class]]) {
+                NSInteger count = -2, *indices = [spec 
indicesOfObjectsByEvaluatingWithContainer:pub count:&count];
+                if (count == 1)
+                    i = indices[0];
+                else if (count == -1 && [[pub localFiles] count] == 1)
+                    i = 0;
+                else
+                    pub = nil;
+            }
         }
         if (pub == nil) {
             [self setScriptErrorNumber:NSArgumentsWrongScriptError];

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