From 210b31476f17d11a4a7fa7e6a1aeb697aaf78e17 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 8 Nov 2011 18:36:52 +0000 Subject: [PATCH] Monotone-Parent: 2cafdbe57b649f3842f8bc101e3a2eb5ff10af5c Monotone-Revision: 113f81e1676d886a71b93cdd6b7aff23ada6b5e4 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-11-08T18:36:52 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 ++++++++ OpenChange/MAPIStoreRecurrenceUtils.m | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9b04a449..921f052d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-11-08 Wolfgang Sourdeau + + * OpenChange/MAPIStoreRecurrenceUtils.m + (-fillRecurrencePattern:withStartDate:andEndDate:): fixed a crash + occurring when no byday mask was specified. We also force a value + for the monthday in the case of a yearly event without a proper + one. + 2011-11-07 Wolfgang Sourdeau * OpenChange/MAPIStoreFolder.m (-addProperties:): we now override diff --git a/OpenChange/MAPIStoreRecurrenceUtils.m b/OpenChange/MAPIStoreRecurrenceUtils.m index 7f283b698..de279b4fe 100644 --- a/OpenChange/MAPIStoreRecurrenceUtils.m +++ b/OpenChange/MAPIStoreRecurrenceUtils.m @@ -305,6 +305,14 @@ rp->FirstDateTime = [moduloDate asMinutesSince1601]; byMonthDay = [[self byMonthDay] objectAtIndex: 0]; + if (!byMonthDay && (freq == iCalRecurrenceFrequenceYearly)) + { + byMonthDay = [NSString stringWithFormat: @"%d", [startDate dayOfMonth]]; + [self warnWithFormat: @"no month day specified in yearly" + @" recurrence: we deduce it from the start date: %@", + byMonthDay]; + } + if (byMonthDay) { if ([byMonthDay intValue] < 0) @@ -325,11 +333,14 @@ { rp->PatternType = PatternType_MonthNth; byDayMask = [self byDayMask]; - days = [byDayMask weekDayOccurrences]; mask = 0; - for (count = 0; count < 7; count++) - if (days[0][count]) - mask |= 1 << count; + days = [byDayMask weekDayOccurrences]; + if (days) + { + for (count = 0; count < 7; count++) + if (days[0][count]) + mask |= 1 << count; + } if (mask) { rp->PatternTypeSpecific.MonthRecurrencePattern.WeekRecurrencePattern = mask;