From 6204aebf2c9143d1b124c82d9a8046944115492e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Mon, 23 Mar 2015 23:57:33 +0100 Subject: [PATCH] oc-calendar: do not crash with invalid events A failure in parsing an ICS makes return a nil calendar object. Instead of creating an appointment with nil information which can lead to crashes like the one generated creating PidLidCleanGlobalObjectId property. We return an empty message with no information which is taken into account in Outlook but not displayed like in SOGo webmail does. --- OpenChange/MAPIStoreCalendarMessage.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenChange/MAPIStoreCalendarMessage.m b/OpenChange/MAPIStoreCalendarMessage.m index 290a50bcd..f5d00e8d4 100644 --- a/OpenChange/MAPIStoreCalendarMessage.m +++ b/OpenChange/MAPIStoreCalendarMessage.m @@ -181,6 +181,12 @@ static Class NSArrayK, MAPIStoreAppointmentWrapperK; else { origCalendar = [sogoObject calendar: YES secure: YES]; + if (!origCalendar) + { + [self errorWithFormat: @"Incorrect calendar event %@. Empty message is created", + [self url]]; + return self; + } calendar = [origCalendar mutableCopy]; masterEvent = [[calendar events] objectAtIndex: 0]; [self _setupAttachmentParts];