From 2606787dd7f6a8f00901dd3e3abc2e345ed27935 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 19 Nov 2012 09:45:48 -0500 Subject: [PATCH] Make sure we handle arrays, and not single-value string objects. --- SoObjects/SOGo/SOGoGroup.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SoObjects/SOGo/SOGoGroup.m b/SoObjects/SOGo/SOGoGroup.m index 1718ccdf2..63010ec13 100644 --- a/SoObjects/SOGo/SOGoGroup.m +++ b/SoObjects/SOGo/SOGoGroup.m @@ -69,6 +69,11 @@ #import #import +#define CHECK_CLASS(o) ({ \ + if ([o isKindOfClass: [NSString class]]) \ + o = [NSArray arrayWithObject: o]; \ +}) + @implementation SOGoGroup - (id) initWithIdentifier: (NSString *) theID @@ -232,14 +237,17 @@ // Fetch "members" - we get DNs d = [_entry asDictionary]; o = [d objectForKey: @"member"]; + CHECK_CLASS(o); if (o) [dns addObjectsFromArray: o]; // Fetch "uniqueMembers" - we get DNs o = [d objectForKey: @"uniquemember"]; + CHECK_CLASS(o); if (o) [dns addObjectsFromArray: o]; // Fetch "memberUid" - we get UID (like login names) o = [d objectForKey: @"memberuid"]; + CHECK_CLASS(o); if (o) [uids addObjectsFromArray: o]; c = [dns count] + [uids count];