From 2bcb81a1c6191cf5c00084d120c8b5a4b442f745 Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Sat, 9 Feb 2002 01:55:37 +0000 Subject: check if the CalComponentDateTime values are set before trying to use 2002-02-08 Damon Chaplin * gui/comp-util.c (cal_comp_util_compare_event_timezones): check if the CalComponentDateTime values are set before trying to use them. Possibly fixes bug #18529. svn path=/trunk/; revision=15630 --- calendar/gui/comp-util.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'calendar/gui/comp-util.c') diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index 6b11322c05..5edfb90af5 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -109,7 +109,8 @@ cal_comp_util_compare_event_timezones (CalComponent *comp, /* If either the DTSTART or the DTEND is a DATE value, we return TRUE. Maybe if one was a DATE-TIME we should check that, but that should not happen often. */ - if (start_datetime.value->is_date || end_datetime.value->is_date) { + if ((start_datetime.value && start_datetime.value->is_date) + || (end_datetime.value && end_datetime.value->is_date)) { retval = TRUE; goto out; } @@ -117,7 +118,8 @@ cal_comp_util_compare_event_timezones (CalComponent *comp, /* If the event uses UTC for DTSTART & DTEND, return TRUE. Outlook will send single events as UTC, so we don't want to mark all of these. */ - if (start_datetime.value->is_utc && end_datetime.value->is_utc) { + if ((!start_datetime.value || start_datetime.value->is_utc) + && (!end_datetime.value || end_datetime.value->is_utc)) { retval = TRUE; goto out; } @@ -146,28 +148,35 @@ cal_comp_util_compare_event_timezones (CalComponent *comp, if (status != CAL_CLIENT_GET_SUCCESS) goto out; - offset1 = icaltimezone_get_utc_offset (start_zone, - start_datetime.value, - NULL); - offset2 = icaltimezone_get_utc_offset (zone, - start_datetime.value, - NULL); - if (offset1 == offset2) { - status = cal_client_get_timezone (client, - end_datetime.tzid, - &end_zone); - if (status != CAL_CLIENT_GET_SUCCESS) + if (start_datetime.value) { + offset1 = icaltimezone_get_utc_offset (start_zone, + start_datetime.value, + NULL); + offset2 = icaltimezone_get_utc_offset (zone, + start_datetime.value, + NULL); + if (offset1 != offset2) goto out; + } + status = cal_client_get_timezone (client, + end_datetime.tzid, + &end_zone); + if (status != CAL_CLIENT_GET_SUCCESS) + goto out; + + if (end_datetime.value) { offset1 = icaltimezone_get_utc_offset (end_zone, end_datetime.value, NULL); offset2 = icaltimezone_get_utc_offset (zone, end_datetime.value, NULL); - if (offset1 == offset2) - retval = TRUE; + if (offset1 != offset2) + goto out; } + + retval = TRUE; } out: -- cgit v1.2.3