diff options
author | Damon Chaplin <damon@ximian.com> | 2002-02-09 09:55:37 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2002-02-09 09:55:37 +0800 |
commit | 2bcb81a1c6191cf5c00084d120c8b5a4b442f745 (patch) | |
tree | 5f408bc4fec74ad0ec233511e1e4b9920c1d0fcc | |
parent | 28c6d294af7c6c457fc3c1aef41501a4a714370c (diff) | |
download | gsoc2013-evolution-2bcb81a1c6191cf5c00084d120c8b5a4b442f745.tar.gz gsoc2013-evolution-2bcb81a1c6191cf5c00084d120c8b5a4b442f745.tar.zst gsoc2013-evolution-2bcb81a1c6191cf5c00084d120c8b5a4b442f745.zip |
check if the CalComponentDateTime values are set before trying to use
2002-02-08 Damon Chaplin <damon@ximian.com>
* 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
-rw-r--r-- | calendar/ChangeLog | 4 | ||||
-rw-r--r-- | calendar/gui/comp-util.c | 39 |
2 files changed, 28 insertions, 15 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 9af5c2b585..a7a470acce 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,9 @@ 2002-02-08 Damon Chaplin <damon@ximian.com> + * 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. + * importers/icalendar-importer.c: added vCalendar importer and intelligent GnomeCalendar importer code here, as it shares a lot of code with the iCalendar importer. 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: |