diff --git a/ChangeLog b/ChangeLog index e00779233..9cc24ef9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-10-23 Wolfgang Sourdeau + * SoObjects/SOGo/NSArray+Utilities.m + ([NSArray -stringsWithFormat:format]): replace instances of NSNull + with empty strings. + + * SoObjects/SOGo/NSDictionary+Utilities.m ([NSDictionary + -keysWithFormat:keyFormat]): replace instances of NSNull with + empty strings. + * SoObjects/Contacts/SOGoContactLDAPFolder.m: if "displayName" is empty, use "c_cn" instead. diff --git a/SoObjects/SOGo/NSArray+Utilities.m b/SoObjects/SOGo/NSArray+Utilities.m index 4845b33df..3f5a78b5a 100644 --- a/SoObjects/SOGo/NSArray+Utilities.m +++ b/SoObjects/SOGo/NSArray+Utilities.m @@ -20,6 +20,7 @@ * Boston, MA 02111-1307, USA. */ +#import #import #import "NSArray+Utilities.h" @@ -38,8 +39,11 @@ currentObject = [objects nextObject]; while (currentObject) { - [formattedStrings - addObject: [NSString stringWithFormat: format, currentObject]]; + if ([currentObject isKindOfClass: [NSNull class]]) + [formattedStrings addObject: @""]; + else + [formattedStrings + addObject: [NSString stringWithFormat: format, currentObject]]; currentObject = [objects nextObject]; } diff --git a/SoObjects/SOGo/NSDictionary+Utilities.m b/SoObjects/SOGo/NSDictionary+Utilities.m index 666aef023..485b9dfb2 100644 --- a/SoObjects/SOGo/NSDictionary+Utilities.m +++ b/SoObjects/SOGo/NSDictionary+Utilities.m @@ -22,6 +22,7 @@ #import #import +#import #import #import "NSArray+Utilities.h" @@ -89,8 +90,12 @@ for (count = 0; count < max; count++) { value = [self objectForKey: [allKeys objectAtIndex: count]]; - [keysWithFormat replaceString: [keys objectAtIndex: count] - withString: [value description]]; + if ([value isKindOfClass: [NSNull class]]) + [keysWithFormat replaceString: [keys objectAtIndex: count] + withString: @""]; + else + [keysWithFormat replaceString: [keys objectAtIndex: count] + withString: [value description]]; } return keysWithFormat;