From d4046673eebf21180f494e516a39a7b04243f669 Mon Sep 17 00:00:00 2001 From: smizrahi Date: Mon, 8 Apr 2024 13:57:07 +0200 Subject: [PATCH] fix(calendar): Fix assertion when is_cycle is set but without c_cycleinfo --- .../Appointments/SOGoAppointmentFolder.m | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index e69c97cb2..9a96d4d46 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -1255,6 +1255,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir NSInteger offset; id tz; + content = nil; if ([theRecord objectForKey: @"c_cycleinfo"] && [[theRecord objectForKey: @"c_cycleinfo"] isKindOfClass: [NSData class]]) { content = [NSString stringWithUTF8String: [[theRecord objectForKey: @"c_cycleinfo"] bytes]]; } else if ([theRecord objectForKey: @"c_cycleinfo"] && [[theRecord objectForKey: @"c_cycleinfo"] isKindOfClass: [NSString class]]) { @@ -1289,16 +1290,23 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir } - cycleinfo = [content propertyList]; - if (!cycleinfo) + if (![content isNotNull]) { + cycleinfo = [content propertyList]; + if (!cycleinfo) + { + [self errorWithFormat:@"cyclic record doesn't have cycleinfo -> %@", theRecord]; + return; + } + rules = [cycleinfo objectForKey: @"rules"]; + exRules = [cycleinfo objectForKey: @"exRules"]; + rDates = [cycleinfo objectForKey: @"rDates"]; + exDates = [cycleinfo objectForKey: @"exDates"]; + } else { [self errorWithFormat:@"cyclic record doesn't have cycleinfo -> %@", theRecord]; return; } - rules = [cycleinfo objectForKey: @"rules"]; - exRules = [cycleinfo objectForKey: @"exRules"]; - rDates = [cycleinfo objectForKey: @"rDates"]; - exDates = [cycleinfo objectForKey: @"exDates"]; + eventTimeZone = nil; allDayTimeZone = nil; tz = nil;