From 6768cadd8d66cbb219636d844f50c1fedcc8a510 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 24 Sep 2004 13:54:21 +0000 Subject: Fixes #66344 2004-09-24 JP Rosevear Fixes #66344 * gui/e-cal-model-calendar.c (get_dtend): check for existence of property and null time instead of sending through bad data * gui/e-cal-model.c (get_dtstart): ditto * gui/e-cal-model-tasks.c (get_completed): ditto (get_due): ditto svn path=/trunk/; revision=27368 --- calendar/gui/e-cal-model-calendar.c | 14 ++++++++++---- calendar/gui/e-cal-model-tasks.c | 4 ++-- calendar/gui/e-cal-model.c | 10 ++++++++-- 3 files changed, 20 insertions(+), 8 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c index 479f51fbd6..63532c5be8 100644 --- a/calendar/gui/e-cal-model-calendar.c +++ b/calendar/gui/e-cal-model-calendar.c @@ -112,20 +112,26 @@ ecmc_column_count (ETableModel *etm) } static ECellDateEditValue * -get_dtend (ECalModel *model, ECalModelComponent *comp_data) +get_dtend (ECalModelCalendar *model, ECalModelComponent *comp_data) { struct icaltimetype tt_end; if (!comp_data->dtend) { + icalproperty *prop; icaltimezone *zone; gboolean got_zone = FALSE; - tt_end = icalcomponent_get_dtend (comp_data->icalcomp); + prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DTEND_PROPERTY); + if (!prop) + return NULL; + + tt_end = icalproperty_get_dtend (prop); + if (icaltime_get_tzid (tt_end) && e_cal_get_timezone (comp_data->client, icaltime_get_tzid (tt_end), &zone, NULL)) got_zone = TRUE; - if ((e_cal_model_get_flags (model) & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES) && + if ((e_cal_model_get_flags (E_CAL_MODEL (model)) & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES) && (e_cal_util_component_has_recurrences (comp_data->icalcomp))) { if (got_zone) tt_end = icaltime_from_timet_with_zone (comp_data->instance_end, tt_end.is_date, zone); @@ -133,7 +139,7 @@ get_dtend (ECalModel *model, ECalModelComponent *comp_data) tt_end = icaltime_from_timet (comp_data->instance_end, tt_end.is_date); } - if (!icaltime_is_valid_time (tt_end)) + if (!icaltime_is_valid_time (tt_end) || icaltime_is_null_time (tt_end)) return NULL; comp_data->dtend = g_new0 (ECellDateEditValue, 1); diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c index fe162cc388..508406c80d 100644 --- a/calendar/gui/e-cal-model-tasks.c +++ b/calendar/gui/e-cal-model-tasks.c @@ -242,7 +242,7 @@ get_completed (ECalModelComponent *comp_data) return NULL; tt_completed = icalproperty_get_completed (prop); - if (!icaltime_is_valid_time (tt_completed)) + if (!icaltime_is_valid_time (tt_completed) || icaltime_is_null_time (tt_completed)) return NULL; comp_data->completed = g_new0 (ECellDateEditValue, 1); @@ -272,7 +272,7 @@ get_due (ECalModelComponent *comp_data) return NULL; tt_due = icalproperty_get_due (prop); - if (!icaltime_is_valid_time (tt_due)) + if (!icaltime_is_valid_time (tt_due) || icaltime_is_null_time (tt_due)) return NULL; comp_data->due = g_new0 (ECellDateEditValue, 1); diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 59530dfee7..87f23b2f45 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -401,10 +401,16 @@ get_dtstart (ECalModel *model, ECalModelComponent *comp_data) priv = model->priv; if (!comp_data->dtstart) { + icalproperty *prop; icaltimezone *zone; gboolean got_zone = FALSE; - tt_start = icalcomponent_get_dtstart (comp_data->icalcomp); + prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DTSTART_PROPERTY); + if (!prop) + return NULL; + + tt_start = icalproperty_get_dtstart (prop); + if (icaltime_get_tzid (tt_start) && e_cal_get_timezone (comp_data->client, icaltime_get_tzid (tt_start), &zone, NULL)) got_zone = TRUE; @@ -417,7 +423,7 @@ get_dtstart (ECalModel *model, ECalModelComponent *comp_data) tt_start = icaltime_from_timet (comp_data->instance_start, tt_start.is_date); } - if (!icaltime_is_valid_time (tt_start)) + if (!icaltime_is_valid_time (tt_start) || icaltime_is_null_time (tt_start)) return NULL; comp_data->dtstart = g_new0 (ECellDateEditValue, 1); -- cgit v1.2.3