diff --git a/ChangeLog b/ChangeLog index 3316adc76..d6dce8142 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-09-30 Wolfgang Sourdeau + + * SoObjects/SOGo/NSDictionary+BSJSONAdditions.m + (+[NSMutableDictionary dictionaryWithJSONString:]): return nil + directly if the json string is empty. + 2010-09-28 Wolfgang Sourdeau * SoObjects/SOGo/SOGoUser.m (-_appendSystemMailAccount): cleaned diff --git a/SoObjects/SOGo/NSDictionary+BSJSONAdditions.m b/SoObjects/SOGo/NSDictionary+BSJSONAdditions.m index 729d9df41..ba1dd9958 100644 --- a/SoObjects/SOGo/NSDictionary+BSJSONAdditions.m +++ b/SoObjects/SOGo/NSDictionary+BSJSONAdditions.m @@ -191,12 +191,20 @@ const int jsonDoNotIndent = -1; @implementation NSMutableDictionary (BSJSONAdditions) -+ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString ++ (NSMutableDictionary *) dictionaryWithJSONString: (NSString *) jsonString { - NSScanner *scanner = [[NSScanner alloc] initWithString:jsonString]; - NSMutableDictionary *dictionary = nil; - [scanner scanJSONObject:&dictionary]; - [scanner release]; + NSScanner *scanner; + NSMutableDictionary *dictionary; + + dictionary = nil; + + if ([jsonString length] > 0) + { + scanner = [[NSScanner alloc] initWithString: jsonString]; + [scanner scanJSONObject:&dictionary]; + [scanner autorelease]; + } + return dictionary; }