Revision: 22597
          http://sourceforge.net/p/bibdesk/svn/22597
Author:   hofman
Date:     2018-09-14 10:00:00 +0000 (Fri, 14 Sep 2018)
Log Message:
-----------
handle setting empty string for category group name

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

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2018-09-14 06:30:35 UTC (rev 22596)
+++ trunk/bibdesk/BibItem.m     2018-09-14 10:00:00 UTC (rev 22597)
@@ -3324,8 +3324,12 @@
     if([field isPersonField]){
                BDSKASSERT([groupName isKindOfClass:[BibAuthor class]] && 
[newGroupName isKindOfClass:[BibAuthor class]]);
         NSMutableArray *authors = [[NSMutableArray alloc] init];
-               for (BibAuthor *auth in [self peopleArrayForField:field])
-            [authors addObject:[auth fuzzyEqual:groupName] ? newGroupName : 
auth];
+        for (BibAuthor *auth in [self peopleArrayForField:field]) {
+            if ([auth fuzzyEqual:groupName] == NO)
+                [authors addObject:auth];
+            else if ([NSString isEmptyString:[groupName originalName]] == NO)
+                [authors addObject:newGroupName];
+        }
         [self setField:field toValue:[[authors valueForKey:@"originalName"] 
componentsJoinedByString:@" and "]];
                [authors release];
                return operation;
@@ -3362,12 +3366,15 @@
                if(foundToken){
                        token = [token 
stringByTrimmingCharactersInSet:whitespaceAndNewlineCharacterSet];
                        if([NSString isEmptyString:token] == NO){
-                               [string appendString:lastDelimiter];
-                               if([token isCaseInsensitiveEqual:groupName])
-                                       [string appendString:newGroupName];
-                               else
-                                       [string appendString:token];
-                               addedToken = YES;
+                if([token isCaseInsensitiveEqual:groupName] == NO) {
+                    [string appendString:lastDelimiter];
+                    [string appendString:token];
+                    addedToken = YES;
+                } else if ([NSString isEmptyString:newGroupName] == NO) {
+                    [string appendString:lastDelimiter];
+                    [string appendString:newGroupName];
+                    addedToken = YES;
+                }
                        }
                }
                // skip the delimiter or " and ", and any whitespace following 
it

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to