(fix) safe-guarding against bogus value coming from the quick tables

pull/198/head
Ludovic Marcotte 2016-02-08 10:32:18 -05:00
parent d63e277fc6
commit 1d2763af3c
2 changed files with 16 additions and 10 deletions

1
NEWS
View File

@ -6,6 +6,7 @@ Enhancements
Bug fixes
- [web] handle birthday dates before 1970
- [web] safe-guarding against bogus value coming from the quick tables
3.0.1 (2016-02-05)
------------------

View File

@ -902,17 +902,22 @@ static inline iCalPersonPartStat _userStateInEvent (NSArray *event)
state = iCalPersonPartStatOther;
participants = [event objectAtIndex: eventPartMailsIndex];
states = [event objectAtIndex: eventPartStatesIndex];
count = 0;
max = [participants count];
user = [SOGoUser userWithLogin: [event objectAtIndex: eventOwnerIndex]
roles: nil];
while (state == iCalPersonPartStatOther && count < max)
// We guard ourself against bogus value coming from the quick tables
if ([participants isKindOfClass: [NSArray class]])
{
if ([user hasEmail: [participants objectAtIndex: count]])
state = [[states objectAtIndex: count] intValue];
else
count++;
states = [event objectAtIndex: eventPartStatesIndex];
count = 0;
max = [participants count];
user = [SOGoUser userWithLogin: [event objectAtIndex: eventOwnerIndex]
roles: nil];
while (state == iCalPersonPartStatOther && count < max)
{
if ([user hasEmail: [participants objectAtIndex: count]])
state = [[states objectAtIndex: count] intValue];
else
count++;
}
}
return state;