Index: evolution-2.28.2/calendar/gui/e-cal-list-view.c
===================================================================
--- evolution-2.28.2.orig/calendar/gui/e-cal-list-view.c
+++ evolution-2.28.2/calendar/gui/e-cal-list-view.c
@@ -432,6 +432,9 @@ e_cal_list_view_get_selected_time_range
 		ECalComponentDateTime dtstart, dtend;
 		ECalComponent *comp;
 
+		if (!is_comp_data_valid (event))
+			return FALSE;
+
 		comp = e_cal_component_new ();
 		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 		if (start_time) {
Index: evolution-2.28.2/calendar/gui/e-calendar-view.c
===================================================================
--- evolution-2.28.2.orig/calendar/gui/e-calendar-view.c
+++ evolution-2.28.2/calendar/gui/e-calendar-view.c
@@ -804,7 +804,7 @@ e_calendar_view_copy_clipboard (ECalenda
 	for (l = selected; l != NULL; l = l->next) {
 		event = (ECalendarViewEvent *) l->data;
 
-		if (event) {
+		if (event && is_comp_data_valid (event)) {
 			e_cal_util_add_timezones_from_component (vcal_comp, event->comp_data->icalcomp);
 
 			add_related_timezones (vcal_comp, event->comp_data->icalcomp, event->comp_data->client);
@@ -814,6 +814,9 @@ e_calendar_view_copy_clipboard (ECalenda
 	for (l = selected; l != NULL; l = l->next) {
 		event = (ECalendarViewEvent *) l->data;
 
+		if (!is_comp_data_valid (event))
+			continue;
+		
 		new_icalcomp = icalcomponent_new_clone (event->comp_data->icalcomp);
 
 		/* remove RECURRENCE-IDs from copied objects */
@@ -1021,6 +1024,9 @@ delete_event (ECalendarView *cal_view, E
 	gboolean  delete = FALSE;
 	GError *error = NULL;
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 	vtype = e_cal_component_get_vtype (comp);
@@ -1142,6 +1148,9 @@ e_calendar_view_delete_selected_occurren
 	if (!selected)
 		return;
 	event = (ECalendarViewEvent *) selected->data;
+	if (!is_comp_data_valid (event))
+ 		return;
+	
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 	vtype = e_cal_component_get_vtype (comp);
@@ -1617,6 +1626,9 @@ on_forward (EPopup *ep, EPopupItem *pite
 		ECalComponent *comp;
 		ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
 
+		if (!is_comp_data_valid (event))
+			return;
+
 		comp = e_cal_component_new ();
 		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 		itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, event->comp_data->client, NULL, NULL, NULL, TRUE, FALSE);
@@ -1905,7 +1917,7 @@ e_calendar_view_open_event (ECalendarVie
 	selected = e_calendar_view_get_selected_events (cal_view);
 	if (selected) {
 		ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
-		if (event)
+		if (event && is_comp_data_valid (event))
 			e_calendar_view_edit_appointment (cal_view, event->comp_data->client,
 					event->comp_data->icalcomp, icalcomponent_get_first_property(event->comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY) != NULL);
 
@@ -2383,6 +2395,9 @@ e_calendar_view_get_tooltips (ECalendarV
 	default_zone = e_calendar_view_get_timezone  (data->cal_view);
 	pevent = data->get_view_event (data->cal_view, data->day, data->event_num);
 
+	if (!is_comp_data_valid (pevent))
+		return FALSE;
+
 	client = pevent->comp_data->client;
 
 	clone_comp = icalcomponent_new_clone (pevent->comp_data->icalcomp);
@@ -2705,3 +2720,38 @@ get_today_background (const GdkColor bas
 	return res;
 }
 
+gboolean
+is_comp_data_valid_func (ECalendarViewEvent *event, const gchar *location)
+{
+	g_return_val_if_fail (location != NULL, FALSE);
+
+	if (!event) {
+		g_warning ("%s: event is NULL", location);
+		return FALSE;
+	}
+
+	if (!event->comp_data) {
+		g_warning ("%s: event's (%p) comp_data is NULL", location, event);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+gboolean
+is_array_index_in_bounds_func (GArray *array, gint index, const gchar *location)
+{
+	g_return_val_if_fail (location != NULL, FALSE);
+
+	if (!array) {
+		g_warning ("%s: array is NULL", location);
+		return FALSE;
+	}
+
+	if (index < 0 || index >= array->len) {
+		g_warning ("%s: index %d is out of bounds [0,%d) at array %p", location, index, array->len, array);
+		return FALSE;
+	}
+
+	return TRUE;
+}
Index: evolution-2.28.2/calendar/gui/e-calendar-view.h
===================================================================
--- evolution-2.28.2.orig/calendar/gui/e-calendar-view.h
+++ evolution-2.28.2/calendar/gui/e-calendar-view.h
@@ -78,6 +78,15 @@ typedef struct {
 	E_CALENDAR_VIEW_EVENT_FIELDS
 } ECalendarViewEvent;
 
+/* checks if event->comp_data is not NULL, returns FALSE when it is and prints a warning on a console */
+gboolean is_comp_data_valid_func (ECalendarViewEvent *event, const gchar *location);
+#define is_comp_data_valid(_event) is_comp_data_valid_func ((ECalendarViewEvent *) (_event), G_STRFUNC)
+
+/* checks if index is within bounds for the array; returns FALSE when not, and prints a warning on a console */
+gboolean is_array_index_in_bounds_func (GArray *array, gint index, const gchar *location);
+#define is_array_index_in_bounds(_array, _index) is_array_index_in_bounds_func (_array, _index, G_STRFUNC)
+
+
 typedef struct _ECalendarView        ECalendarView;
 typedef struct _ECalendarViewClass   ECalendarViewClass;
 typedef struct _ECalendarViewPrivate ECalendarViewPrivate;
Index: evolution-2.28.2/calendar/gui/e-day-view-main-item.c
===================================================================
--- evolution-2.28.2.orig/calendar/gui/e-day-view-main-item.c
+++ evolution-2.28.2/calendar/gui/e-day-view-main-item.c
@@ -454,6 +454,9 @@ e_day_view_main_item_draw_events_in_vbar
 	for (event_num = 0; event_num < day_view->events[day]->len; event_num++) {
 		event = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
 
+		if (!is_comp_data_valid (event))
+ 			continue;
+		
 		/* We can skip the events in the first column since they will
 		   draw over this anyway. */
 		if (event->num_columns > 0 && event->start_row_or_col == 0) {
@@ -519,6 +522,9 @@ e_day_view_main_item_draw_long_events_in
 		gboolean first = TRUE;
 		event = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
 
+		if (!is_comp_data_valid (event))
+			continue;
+
 		/* If the event is TRANSPARENT, skip it. */
 		if (icalcomp_is_transparent (event->comp_data->icalcomp)) {
 			continue;
@@ -672,9 +678,15 @@ e_day_view_main_item_draw_day_event (EDa
 
 	font_options = get_font_options ();
 
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	/* Fill in the event background. Note that for events in the first
 	   column of the day, we might not want to paint over the vertical bar,
 	   since that is used for multiple events. But then you can't see
Index: evolution-2.28.2/calendar/gui/e-day-view-top-item.c
===================================================================
--- evolution-2.28.2.orig/calendar/gui/e-day-view-top-item.c
+++ evolution-2.28.2/calendar/gui/e-day-view-top-item.c
@@ -406,9 +406,15 @@ e_day_view_top_item_draw_long_event (EDa
 						 &item_w, &item_h))
 		return;
 
+	if (!is_array_index_in_bounds (day_view->long_events, event_num))
+		return;
+	
 	event = &g_array_index (day_view->long_events, EDayViewEvent,
 				event_num);
 
+	if (!is_comp_data_valid (event))
+ 		return;
+		
 	style = gtk_widget_get_style (GTK_WIDGET (day_view));
 	gc = day_view->main_gc;
 	fg_gc = style->fg_gc[GTK_STATE_NORMAL];
@@ -747,8 +753,15 @@ e_day_view_top_item_draw_triangle (EDayV
 	if (h % 2 == 0)
 		c1--;
 
+	if (!is_array_index_in_bounds (day_view->long_events, event_num))
+		return;
+
 	event = &g_array_index (day_view->long_events, EDayViewEvent,
 				event_num);
+
+	if (!is_comp_data_valid (event))
+		return;
+
 	cairo_save (cr);
 	/* Fill it in. */
 	if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
Index: evolution-2.28.2/calendar/gui/e-day-view.c
===================================================================
--- evolution-2.28.2.orig/calendar/gui/e-day-view.c
+++ evolution-2.28.2/calendar/gui/e-day-view.c
@@ -1240,7 +1240,7 @@ e_day_view_get_text_color (EDayView *day
 	green = day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND].green;
 	blue = day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND].blue;
 
-	if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data),
+	if (is_comp_data_valid (event) && gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data),
 	     &bg_color)) {
                 GdkColormap *colormap;
 		colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
@@ -1714,6 +1714,9 @@ e_day_view_foreach_event_with_uid (EDayV
 			event = &g_array_index (day_view->events[day],
 						EDayViewEvent, event_num);
 
+			if (!is_comp_data_valid (event))
+				continue;
+
 			u = icalcomponent_get_uid (event->comp_data->icalcomp);
 			if (uid && !strcmp (uid, u)) {
 				if (!(*callback) (day_view, day, event_num, data))
@@ -1728,6 +1731,9 @@ e_day_view_foreach_event_with_uid (EDayV
 		event = &g_array_index (day_view->long_events,
 					EDayViewEvent, event_num);
 
+		if (!is_comp_data_valid (event))
+			continue;
+
 		u = icalcomponent_get_uid (event->comp_data->icalcomp);
 		if (u && !strcmp (uid, u)) {
 			if (!(*callback) (day_view, E_DAY_VIEW_LONG_EVENT, event_num, data))
@@ -1749,12 +1755,19 @@ e_day_view_remove_event_cb (EDayView *da
 		 day, event_num);
 #endif
 
-	if (day == E_DAY_VIEW_LONG_EVENT)
+	if (day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return TRUE;
+
 		event = &g_array_index (day_view->long_events,
 					EDayViewEvent, event_num);
-	else
+	} else {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return TRUE;
+
 		event = &g_array_index (day_view->events[day],
 					EDayViewEvent, event_num);
+	}
 
 	if (!event)
 		return TRUE;
@@ -1774,7 +1787,8 @@ e_day_view_remove_event_cb (EDayView *da
 	if (event->canvas_item)
 		gtk_object_destroy (GTK_OBJECT (event->canvas_item));
 
-	e_cal_model_free_component_data (event->comp_data);
+	if (is_comp_data_valid (event))
+		e_cal_model_free_component_data (event->comp_data);
 	event->comp_data = NULL;
 
 	if (day == E_DAY_VIEW_LONG_EVENT) {
@@ -1798,6 +1812,9 @@ set_text_as_bold (EDayViewEvent *event)
 	gchar *address;
 	ECalComponentAttendee *at = NULL;
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 	address = itip_get_comp_attendee (comp, event->comp_data->client);
@@ -1836,10 +1853,13 @@ e_day_view_update_event_label (EDayView
 	gchar *text;
 	gint interval;
 
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
 
 	/* If the event isn't visible just return. */
-	if (!event->canvas_item)
+	if (!event->canvas_item || !is_comp_data_valid (event))
 		return;
 
 	summary = icalcomponent_get_summary (event->comp_data->icalcomp);
@@ -1887,11 +1907,14 @@ e_day_view_update_long_event_label (EDay
 	const gchar *summary;
 	gboolean free_text = FALSE;
 
+	if (!is_array_index_in_bounds (day_view->long_events, event_num))
+		return;
+
 	event = &g_array_index (day_view->long_events, EDayViewEvent,
 				event_num);
 
 	/* If the event isn't visible just return. */
-	if (!event->canvas_item)
+	if (!event->canvas_item || !is_comp_data_valid (event))
 		return;
 
 	summary = e_calendar_view_get_icalcomponent_summary (event->comp_data->client, event->comp_data->icalcomp, &free_text);
@@ -1976,6 +1999,9 @@ e_day_view_find_event_from_uid (EDayView
 			event = &g_array_index (day_view->events[day],
 						EDayViewEvent, event_num);
 
+			if (!is_comp_data_valid (event))
+				continue;
+
 			if (event->comp_data->client != client)
 				continue;
 
@@ -2004,6 +2030,9 @@ e_day_view_find_event_from_uid (EDayView
 		event = &g_array_index (day_view->long_events,
 					EDayViewEvent, event_num);
 
+		if (!is_comp_data_valid (event))
+			continue;
+
 		if (event->comp_data->client != client)
 			continue;
 
@@ -3069,6 +3098,9 @@ e_day_view_on_long_event_button_press (E
 	} else if (event->button == 3) {
 		EDayViewEvent *e;
 
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return TRUE;
+
 		e = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
 
 		e_day_view_set_selected_time_range_in_top_visible (day_view, e->start, e->end);
@@ -3107,6 +3139,9 @@ e_day_view_on_event_button_press (EDayVi
 	} else if (event->button == 3) {
 		EDayViewEvent *e;
 
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return TRUE;
+
 		e = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
 
 		e_day_view_set_selected_time_range_visible (day_view, e->start, e->end);
@@ -3131,9 +3166,15 @@ e_day_view_on_long_event_click (EDayView
 	gint start_day, end_day, day;
 	gint item_x, item_y, item_w, item_h;
 
+	if (!is_array_index_in_bounds (day_view->long_events, event_num))
+		return;
+
 	event = &g_array_index (day_view->long_events, EDayViewEvent,
 				event_num);
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	/* Ignore clicks on the EText while editing. */
 	if (pos == E_CALENDAR_VIEW_POS_EVENT
 	    && E_TEXT (event->canvas_item)->editing) {
@@ -3204,9 +3245,15 @@ e_day_view_on_event_click (EDayView *day
 	EDayViewEvent *event;
 	gint tmp_day, row, start_row;
 
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	/* Ignore clicks on the EText while editing. */
 	if (pos == E_CALENDAR_VIEW_POS_EVENT
 	    && E_TEXT (event->canvas_item)->editing) {
@@ -3330,12 +3377,22 @@ e_day_view_on_event_double_click (EDayVi
 	EDayViewEvent *event;
 	icalproperty *attendee_prop = NULL;
 
-	if (day == -1)
+	if (day == -1) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 				event_num);
-	else
+	} else {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
+	}
+
+	if (!is_comp_data_valid (event))
+		return;
 
 	attendee_prop = icalcomponent_get_first_property (event->comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
 
@@ -3390,23 +3447,37 @@ e_day_view_get_selected_events (ECalenda
 	g_return_val_if_fail (E_IS_DAY_VIEW (day_view), NULL);
 
 	if (day_view->editing_event_num != -1) {
-		if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT)
+		if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT) {
+			if (!is_array_index_in_bounds (day_view->long_events, day_view->editing_event_num))
+				return NULL;
+
 			event = &g_array_index (day_view->long_events,
 						EDayViewEvent,
 						day_view->editing_event_num);
-		else
+		} else {
+			if (!is_array_index_in_bounds (day_view->events[day_view->editing_event_day], day_view->editing_event_num))
+				return NULL;
+
 			event = &g_array_index (day_view->events[day_view->editing_event_day],
 						EDayViewEvent,
 						day_view->editing_event_num);
+		}
 	} else if (day_view->popup_event_num != -1) {
-		if (day_view->popup_event_day == E_DAY_VIEW_LONG_EVENT)
+		if (day_view->popup_event_day == E_DAY_VIEW_LONG_EVENT) {
+			if (!is_array_index_in_bounds (day_view->long_events, day_view->popup_event_num))
+				return NULL;
+
 			event = &g_array_index (day_view->long_events,
 						EDayViewEvent,
 						day_view->popup_event_num);
-		else
+		} else {
+			if (!is_array_index_in_bounds (day_view->events[day_view->popup_event_day], day_view->popup_event_num))
+				return NULL;
+
 			event = &g_array_index (day_view->events[day_view->popup_event_day],
 						EDayViewEvent,
 						day_view->popup_event_num);
+		}
 	}
 
 	if (event)
@@ -3554,9 +3625,13 @@ e_day_view_on_top_canvas_motion (GtkWidg
 	pos = e_day_view_convert_position_in_top_canvas (day_view,
 							 canvas_x, canvas_y,
 							 &day, &event_num);
-	if (event_num != -1)
+	if (event_num != -1) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return FALSE;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 					event_num);
+	}
 
 	if (day_view->selection_is_being_dragged) {
 		e_day_view_update_selection (day_view, day, -1);
@@ -3569,9 +3644,15 @@ e_day_view_on_top_canvas_motion (GtkWidg
 	} else if (day_view->pressed_event_day == E_DAY_VIEW_LONG_EVENT) {
 		GtkTargetList *target_list;
 
+		if (!is_array_index_in_bounds (day_view->long_events, day_view->pressed_event_num))
+			return FALSE;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 					day_view->pressed_event_num);
 
+		if (!is_comp_data_valid (event))
+			return FALSE;
+
 		if (!e_cal_util_component_has_recurrences (event->comp_data->icalcomp)
 		    && (abs (canvas_x - day_view->drag_event_x)
 			> E_DAY_VIEW_DRAG_START_OFFSET
@@ -3598,7 +3679,7 @@ e_day_view_on_top_canvas_motion (GtkWidg
 		cursor = day_view->normal_cursor;
 
 		/* Recurring events can't be resized. */
-		if (event && !e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) {
+		if (event && is_comp_data_valid (event) && !e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) {
 			switch (pos) {
 			case E_CALENDAR_VIEW_POS_LEFT_EDGE:
 			case E_CALENDAR_VIEW_POS_RIGHT_EDGE:
@@ -3652,9 +3733,13 @@ e_day_view_on_main_canvas_motion (GtkWid
 							  canvas_x, canvas_y,
 							  &day, &row,
 							  &event_num);
-	if (event_num != -1)
+	if (event_num != -1) {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return FALSE;
+
 		event = &g_array_index (day_view->events[day], EDayViewEvent,
 					event_num);
+	}
 
 	if (day_view->selection_is_being_dragged) {
 		if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
@@ -3702,7 +3787,7 @@ e_day_view_on_main_canvas_motion (GtkWid
 		cursor = day_view->normal_cursor;
 
 		/* Check if the event is editable and client is not readonly while changing the cursor */
-		if (event && event->is_editable && e_cal_is_read_only (event->comp_data->client, &read_only, NULL) && !read_only) {
+		if (event && event->is_editable && is_comp_data_valid (event) && e_cal_is_read_only (event->comp_data->client, &read_only, NULL) && !read_only) {
 
 			switch (pos) {
 			case E_CALENDAR_VIEW_POS_LEFT_EDGE:
@@ -3893,10 +3978,14 @@ e_day_view_update_resize (EDayView *day_
 
 	day = day_view->resize_event_day;
 	event_num = day_view->resize_event_num;
+
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 
-	if (event && (!event->is_editable || (e_cal_is_read_only (event->comp_data->client, &read_only, NULL) && read_only))) {
+	if (event && (!event->is_editable || !is_comp_data_valid (event) || (e_cal_is_read_only (event->comp_data->client, &read_only, NULL) && read_only))) {
 		return;
 	}
 
@@ -3941,9 +4030,16 @@ e_day_view_finish_long_event_resize (EDa
 	gint is_date;
 
 	event_num = day_view->resize_event_num;
+
+	if (!is_array_index_in_bounds (day_view->long_events, event_num))
+		return;
+
 	event = &g_array_index (day_view->long_events, EDayViewEvent,
 				event_num);
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	client = event->comp_data->client;
 
 	/* We use a temporary copy of the comp since we don't want to
@@ -4052,9 +4148,16 @@ e_day_view_finish_resize (EDayView *day_
 
 	day = day_view->resize_event_day;
 	event_num = day_view->resize_event_num;
+
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	client = event->comp_data->client;
 
 	/* We use a temporary shallow copy of the ico since we don't want to
@@ -4202,7 +4305,8 @@ e_day_view_free_event_array (EDayView *d
 		if (event->canvas_item)
 			gtk_object_destroy (GTK_OBJECT (event->canvas_item));
 
-		e_cal_model_free_component_data (event->comp_data);
+		if (is_comp_data_valid (event))
+			e_cal_model_free_component_data (event->comp_data);
 	}
 
 	g_array_set_size (array, 0);
@@ -4415,6 +4519,9 @@ e_day_view_reshape_long_event (EDayView
 	PangoContext *pango_context;
 	PangoLayout *layout;
 
+	if (!is_array_index_in_bounds (day_view->long_events, event_num))
+		return;
+
 	event = &g_array_index (day_view->long_events, EDayViewEvent,
 				event_num);
 
@@ -4429,6 +4536,9 @@ e_day_view_reshape_long_event (EDayView
 		return;
 	}
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	/* Take off the border and padding. */
 	item_x += E_DAY_VIEW_LONG_EVENT_BORDER_WIDTH + E_DAY_VIEW_LONG_EVENT_X_PAD;
 	item_w -= (E_DAY_VIEW_LONG_EVENT_BORDER_WIDTH + E_DAY_VIEW_LONG_EVENT_X_PAD) * 2;
@@ -4574,6 +4684,10 @@ e_day_view_reshape_day_events (EDayView
 
 		e_day_view_reshape_day_event (day_view, day, event_num);
 		event = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
+
+		if (!is_comp_data_valid (event))
+			continue;
+
 		current_comp_string = icalcomponent_as_ical_string_r (event->comp_data->icalcomp);
 		if (day_view->last_edited_comp_string == NULL) {
 			g_free (current_comp_string);
@@ -4598,6 +4712,9 @@ e_day_view_reshape_day_event (EDayView *
 	gint item_x, item_y, item_w, item_h;
 	gint num_icons, icons_offset;
 
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 
@@ -4619,9 +4736,9 @@ e_day_view_reshape_day_event (EDayView *
 		   draw them on top of the resize rect. */
 		icons_offset = 0;
 		num_icons = 0;
-		if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE
+		if (is_comp_data_valid (event) && (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE
 		    || day_view->resize_event_day != day
-		    || day_view->resize_event_num != event_num) {
+		    || day_view->resize_event_num != event_num)) {
 			ECalComponent *comp;
 
 			comp = e_cal_component_new ();
@@ -5669,13 +5786,22 @@ e_day_view_start_editing_event (EDayView
 		return;
 
 	if (day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 					event_num);
 	} else {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day], EDayViewEvent,
 					event_num);
 	}
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	if (!e_cal_is_read_only (event->comp_data->client, &read_only, NULL) || read_only)
 		return;
 
@@ -5747,10 +5873,20 @@ cancel_editing (EDayView *day_view)
 
 	g_return_if_fail (day != -1);
 
-	if (day == E_DAY_VIEW_LONG_EVENT)
+	if (day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
-	else
+	} else {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
+	}
+
+	if (!is_comp_data_valid (event))
+		return;
 
 	/* Reset the text to what was in the component */
 
@@ -5769,9 +5905,15 @@ tooltip_get_view_event (EDayView *day_vi
 	EDayViewEvent *pevent;
 
 	if (day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return  NULL;
+
 		pevent = &g_array_index (day_view->long_events, EDayViewEvent,
 					event_num);
 	} else {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return NULL;
+
 		pevent = &g_array_index (day_view->events[day], EDayViewEvent,
 					event_num);
 	}
@@ -5980,6 +6122,9 @@ e_day_view_event_move (ECalendarView *ca
 	if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
 		return FALSE;
 
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return FALSE;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 	day_view->resize_event_day = day;
@@ -6056,8 +6201,16 @@ e_day_view_change_event_time (EDayView *
 
 	day = day_view->editing_event_day;
 	event_num = day_view->editing_event_num;
+
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
+
+	if (!is_comp_data_valid (event))
+		return;
+
 	client = event->comp_data->client;
 
 	/* We use a temporary shallow copy of the ico since we don't want to
@@ -6131,6 +6284,10 @@ e_day_view_change_event_end_time_up (EDa
 	event_num = day_view->editing_event_num;
 	if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
 		return;
+
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 	day_view->resize_event_day = day;
@@ -6161,6 +6318,10 @@ e_day_view_change_event_end_time_down (E
 	event_num = day_view->editing_event_num;
 	if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
 		return;
+
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 	day_view->resize_event_day = day;
@@ -6262,14 +6423,23 @@ e_day_view_on_editing_stopped (EDayView
 		return;
 
 	if (day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 					event_num);
 	} else {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day], EDayViewEvent,
 					event_num);
 
 	}
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	/* Reset the edit fields. */
 	day_view->editing_event_day = -1;
 	day_view->editing_event_num = -1;
@@ -6606,6 +6776,9 @@ e_day_view_get_event_rows (EDayView *day
 	g_return_val_if_fail (day < E_DAY_VIEW_LONG_EVENT, FALSE);
 	g_return_val_if_fail (event_num >= 0, FALSE);
 
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return FALSE;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 	start_row = event->start_minute / day_view->mins_per_row;
@@ -6630,6 +6803,9 @@ e_day_view_get_event_position (EDayView
 	EDayViewEvent *event;
 	gint start_row, end_row, cols_in_row, start_col, num_columns;
 
+	if (!is_array_index_in_bounds (day_view->events[day], event_num))
+		return FALSE;
+
 	event = &g_array_index (day_view->events[day], EDayViewEvent,
 				event_num);
 
@@ -6684,6 +6860,9 @@ e_day_view_get_long_event_position	(EDay
 {
 	EDayViewEvent *event;
 
+	if (!is_array_index_in_bounds (day_view->long_events, event_num))
+		return FALSE;
+
 	event = &g_array_index (day_view->long_events, EDayViewEvent,
 				event_num);
 
@@ -6951,6 +7130,9 @@ e_day_view_update_top_canvas_drag (EDayV
 	num_days = 1;
 
 	if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, day_view->drag_event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 					day_view->drag_event_num);
 		row = event->start_row_or_col + 1;
@@ -6967,6 +7149,9 @@ e_day_view_update_top_canvas_drag (EDayV
 		day = MIN (day, day_view->days_shown - num_days);
 
 	} else if (day_view->drag_event_day != -1) {
+		if (!is_array_index_in_bounds (day_view->events[day_view->drag_event_day], day_view->drag_event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day_view->drag_event_day],
 					EDayViewEvent,
 					day_view->drag_event_num);
@@ -7014,7 +7199,7 @@ e_day_view_update_top_canvas_drag (EDayV
 	      & GNOME_CANVAS_ITEM_VISIBLE)) {
 		const gchar *summary;
 
-		if (event) {
+		if (event && is_comp_data_valid (event)) {
 			summary = icalcomponent_get_summary (event->comp_data->icalcomp);
 			text = g_strdup (summary);
 		} else {
@@ -7107,9 +7292,15 @@ e_day_view_update_main_canvas_drag (EDay
 	num_rows = 1;
 
 	if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, day_view->drag_event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 					day_view->drag_event_num);
 	} else if (day_view->drag_event_day != -1) {
+		if (!is_array_index_in_bounds (day_view->events[day_view->drag_event_day], day_view->drag_event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day_view->drag_event_day],
 					EDayViewEvent,
 					day_view->drag_event_num);
@@ -7173,7 +7364,7 @@ e_day_view_update_main_canvas_drag (EDay
 	if (!(day_view->drag_item->object.flags & GNOME_CANVAS_ITEM_VISIBLE)) {
 		const gchar *summary;
 
-		if (event) {
+		if (event && is_comp_data_valid (event)) {
 			summary = icalcomponent_get_summary (event->comp_data->icalcomp);
 			text = g_strdup (summary);
 		} else {
@@ -7237,12 +7428,19 @@ e_day_view_on_drag_begin (GtkWidget
 	g_return_if_fail (day != -1);
 	g_return_if_fail (event_num != -1);
 
-	if (day == E_DAY_VIEW_LONG_EVENT)
+	if (day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 					event_num);
-	else
+	} else {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day], EDayViewEvent,
 					event_num);
+	}
 
 	/* Hide the text item, since it will be shown in the special drag
 	   items. */
@@ -7266,10 +7464,16 @@ e_day_view_on_drag_end (GtkWidget      *
 		return;
 
 	if (day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 					event_num);
 		gtk_widget_queue_draw (day_view->top_canvas);
 	} else {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day], EDayViewEvent,
 					event_num);
 		gtk_widget_queue_draw (day_view->main_canvas);
@@ -7300,12 +7504,22 @@ e_day_view_on_drag_data_get (GtkWidget
 	g_return_if_fail (day != -1);
 	g_return_if_fail (event_num != -1);
 
-	if (day == E_DAY_VIEW_LONG_EVENT)
+	if (day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events,
 					EDayViewEvent, event_num);
-	else
+	} else {
+		if (!is_array_index_in_bounds (day_view->events[day], event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day],
 					EDayViewEvent, event_num);
+	}
+
+	if (!is_comp_data_valid (event))
+		return;
 
 	if (info == TARGET_CALENDAR_EVENT || info == TARGET_VCALENDAR) {
 		/* we will pass an icalcalendar component for both types */
@@ -7383,8 +7597,15 @@ e_day_view_on_top_canvas_drag_data_recei
 			end_offset = 0;
 
 			if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT) {
+				if (!is_array_index_in_bounds (day_view->long_events, day_view->drag_event_num))
+					return;
+
 				event = &g_array_index (day_view->long_events, EDayViewEvent,
 							day_view->drag_event_num);
+
+				if (!is_comp_data_valid (event))
+					return;
+
 				day -= day_view->drag_event_offset;
 				day = MAX (day, 0);
 
@@ -7400,9 +7621,15 @@ e_day_view_on_top_canvas_drag_data_recei
 				start_offset = event->start_minute;
 				end_offset = event->end_minute;
 			} else {
+				if (!is_array_index_in_bounds (day_view->events[day_view->drag_event_day], day_view->drag_event_num))
+					return;
+
 				event = &g_array_index (day_view->events[day_view->drag_event_day],
 							EDayViewEvent,
 							day_view->drag_event_num);
+
+				if (!is_comp_data_valid (event))
+					return;
 			}
 
 			client = event->comp_data->client;
@@ -7612,12 +7839,25 @@ e_day_view_on_main_canvas_drag_data_rece
 			end_offset = 0;
 
 			if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT) {
+				if (!is_array_index_in_bounds (day_view->long_events, day_view->drag_event_num))
+					return;
+
 				event = &g_array_index (day_view->long_events, EDayViewEvent,
 							day_view->drag_event_num);
+
+				if (!is_comp_data_valid (event))
+					return;
 			} else {
+				if (!is_array_index_in_bounds (day_view->events[day_view->drag_event_day], day_view->drag_event_num))
+					return;
+
 				event = &g_array_index (day_view->events[day_view->drag_event_day],
 							EDayViewEvent,
 							day_view->drag_event_num);
+
+				if (!is_comp_data_valid (event))
+					return;
+
 				row -= day_view->drag_event_offset;
 
 				/* Calculate time offset from start row. */
@@ -7869,10 +8109,16 @@ e_day_view_paste_text (ECalendarView *ca
 		return;
 
 	if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT) {
+		if (!is_array_index_in_bounds (day_view->long_events, day_view->editing_event_num))
+			return;
+
 		event = &g_array_index (day_view->long_events,
 					EDayViewEvent,
 					day_view->editing_event_num);
 	} else {
+		if (!is_array_index_in_bounds (day_view->events[day_view->editing_event_day], day_view->editing_event_num))
+			return;
+
 		event = &g_array_index (day_view->events[day_view->editing_event_day],
 					EDayViewEvent,
 					day_view->editing_event_num);
Index: evolution-2.28.2/calendar/gui/e-week-view-event-item.c
===================================================================
--- evolution-2.28.2.orig/calendar/gui/e-week-view-event-item.c
+++ evolution-2.28.2/calendar/gui/e-week-view-event-item.c
@@ -283,11 +283,20 @@ e_week_view_event_item_draw (GnomeCanvas
 
 	g_return_if_fail (wveitem->event_num < week_view->events->len);
 
+	if (!is_array_index_in_bounds (week_view->events, wveitem->event_num))
+ 		return;
+	
 	event = &g_array_index (week_view->events, EWeekViewEvent,
 				wveitem->event_num);
 
+	if (!is_comp_data_valid (event))
+ 		return;
+		
 	g_return_if_fail (event->spans_index + wveitem->span_num < week_view->spans->len);
 
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index + wveitem->span_num))
+ 		return;
+	
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 			       event->spans_index + wveitem->span_num);
 
@@ -739,8 +748,14 @@ e_week_view_event_item_draw_icons (EWeek
 
 	week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (wveitem)->canvas)->parent);
 
+	if (!is_array_index_in_bounds (week_view->events, wveitem->event_num))
+ 		return;
+	
 	event = &g_array_index (week_view->events, EWeekViewEvent,
 				wveitem->event_num);
+	if (!is_comp_data_valid (event))
+ 		return;
+	
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 
@@ -853,9 +868,15 @@ e_week_view_event_item_draw_triangle (EW
 
 	week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (wveitem)->canvas)->parent);
 
+	if (!is_array_index_in_bounds (week_view->events, wveitem->event_num))
+ 		return;
+	
 	event = &g_array_index (week_view->events, EWeekViewEvent,
 				wveitem->event_num);
 
+	if (!is_comp_data_valid (event))
+ 		return;
+	
 	gc = week_view->main_gc;
 	cr = gdk_cairo_create (drawable);
 
@@ -961,8 +982,15 @@ e_week_view_event_item_button_press (EWe
 	week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent);
 	g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE);
 
+	if (!is_array_index_in_bounds (week_view->events, wveitem->event_num))
+ 		return FALSE;
+	
 	event = &g_array_index (week_view->events, EWeekViewEvent,
 				wveitem->event_num);
+
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index + wveitem->span_num))
+ 		return FALSE;
+	
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 			       event->spans_index + wveitem->span_num);
 
@@ -1060,14 +1088,25 @@ e_week_view_event_item_double_click (EWe
 	week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent);
 	g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE);
 
+	if (!is_array_index_in_bounds (week_view->events, wveitem->event_num))
+ 		return TRUE;
+	
 	event = &g_array_index (week_view->events, EWeekViewEvent,
 				wveitem->event_num);
 
+	if (!is_comp_data_valid (event))
+		return TRUE;
+		
 	if (week_view->editing_event_num >= 0) {
-		EWeekViewEvent *editing = &g_array_index (week_view->events, EWeekViewEvent, week_view->editing_event_num);
+		EWeekViewEvent *editing;
+		
+		if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+			return TRUE;
+		
+		 editing = &g_array_index (week_view->events, EWeekViewEvent, week_view->editing_event_num);
 
 		/* do not call edit of the component, if double clicked on the component, which is not on the server */
-		if (editing && event && editing->comp_data == event->comp_data && (!event->comp_data || !is_icalcomp_on_the_server (event->comp_data->icalcomp, event->comp_data->client)))
+		if (editing && event && editing->comp_data == event->comp_data && is_comp_data_valid (editing) && (!event->comp_data || !is_icalcomp_on_the_server (event->comp_data->icalcomp, event->comp_data->client)))
 			return TRUE;
 	}
 
Index: evolution-2.28.2/calendar/gui/e-week-view.c
===================================================================
--- evolution-2.28.2.orig/calendar/gui/e-week-view.c
+++ evolution-2.28.2/calendar/gui/e-week-view.c
@@ -850,7 +850,7 @@ e_week_view_get_text_color (EWeekView *w
 	green = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].green;
 	blue = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].blue;
 
-	if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), event->comp_data),
+	if (is_comp_data_valid (event) && gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), event->comp_data),
 	     &bg_color)) {
                 GdkColormap *colormap;
 		colormap = gtk_widget_get_colormap (GTK_WIDGET (week_view));
@@ -1312,9 +1312,16 @@ e_week_view_focus (GtkWidget *widget, Gt
 			EWeekViewEventSpan *span;
 			gint current_day;
 
+			if (!is_array_index_in_bounds (week_view->events, new_event_num))
+				break;
+
 			event = &g_array_index (week_view->events,
 						EWeekViewEvent,
 						new_event_num);
+
+			if (!is_array_index_in_bounds (week_view->spans, event->spans_index + new_span_num))
+				break;
+
 			span = &g_array_index (week_view->spans,
 					       EWeekViewEventSpan,
 					       event->spans_index + new_span_num);
@@ -1344,9 +1351,15 @@ e_week_view_get_selected_events (ECalend
 	g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), NULL);
 
 	if (week_view->editing_event_num != -1) {
+		if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+			return NULL;
+
 		event = &g_array_index (week_view->events, EWeekViewEvent,
 					week_view->editing_event_num);
 	} else if (week_view->popup_event_num != -1) {
+		if (!is_array_index_in_bounds (week_view->events, week_view->popup_event_num))
+			return NULL;
+
 		event = &g_array_index (week_view->events, EWeekViewEvent,
 					week_view->popup_event_num);
 	}
@@ -1927,6 +1940,9 @@ set_text_as_bold (EWeekViewEvent *event,
 	gchar *address;
 	ECalComponentAttendee *at = NULL;
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 	address = itip_get_comp_attendee (comp, event->comp_data->client);
@@ -1972,6 +1988,9 @@ e_week_view_foreach_event_with_uid (EWee
 		event = &g_array_index (week_view->events, EWeekViewEvent,
 					event_num);
 
+		if (!is_comp_data_valid (event))
+			continue;
+
 		u = icalcomponent_get_uid (event->comp_data->icalcomp);
 		if (u && !strcmp (uid, u)) {
 			if (!(*callback) (week_view, event_num, data))
@@ -1989,6 +2008,9 @@ e_week_view_remove_event_cb (EWeekView *
 	EWeekViewEventSpan *span;
 	gint span_num;
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+		return TRUE;
+
 	event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
 	if (!event)
 		return TRUE;
@@ -2001,13 +2023,16 @@ e_week_view_remove_event_cb (EWeekView *
 	if (week_view->popup_event_num == event_num)
 		week_view->popup_event_num = -1;
 
-	e_cal_model_free_component_data (event->comp_data);
+	if (is_comp_data_valid (event))
+		e_cal_model_free_component_data (event->comp_data);
 	event->comp_data = NULL;
 
 	if (week_view->spans) {
 		/* We leave the span elements in the array, but set the canvas item
 		   pointers to NULL. */
 		for (span_num = 0; span_num < event->num_spans; span_num++) {
+			if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+					break;
 			span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 					       event->spans_index + span_num);
 
@@ -2100,6 +2125,9 @@ e_week_view_get_span_position	(EWeekView
 
 	g_return_val_if_fail (span_num < event->num_spans, FALSE);
 
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+		return FALSE;
+
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 			       event->spans_index + span_num);
 
@@ -2142,7 +2170,14 @@ ewv_pass_gdkevent_to_etext (EWeekView *w
 		EWeekViewEvent *event;
 		EWeekViewEventSpan *span;
 
+		if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+			return FALSE;
+
 		event = &g_array_index (week_view->events, EWeekViewEvent, week_view->editing_event_num);
+
+		if (!is_array_index_in_bounds (week_view->spans, event->spans_index + week_view->editing_span_num))
+			return FALSE;
+
 		span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + week_view->editing_span_num);
 
 		if (span->text_item && E_IS_TEXT (span->text_item)) {
@@ -2434,7 +2469,8 @@ e_week_view_free_events (EWeekView *week
 	for (event_num = 0; event_num < week_view->events->len; event_num++) {
 		event = &g_array_index (week_view->events, EWeekViewEvent,
 					event_num);
-		e_cal_model_free_component_data (event->comp_data);
+		if (is_comp_data_valid (event))
+			e_cal_model_free_component_data (event->comp_data);
 	}
 
 	g_array_set_size (week_view->events, 0);
@@ -2616,6 +2652,9 @@ e_week_view_reshape_events (EWeekView *w
 	for (event_num = 0; event_num < week_view->events->len; event_num++) {
 		event = &g_array_index (week_view->events, EWeekViewEvent,
 					event_num);
+		if (!is_comp_data_valid (event))
+			continue;
+
 		for (span_num = 0; span_num < event->num_spans; span_num++) {
 			gchar *current_comp_string;
 
@@ -2626,6 +2665,12 @@ e_week_view_reshape_events (EWeekView *w
 			current_comp_string = icalcomponent_as_ical_string_r (event->comp_data->icalcomp);
 			if (strncmp (current_comp_string, week_view->last_edited_comp_string,50) == 0) {
 				EWeekViewEventSpan *span;
+
+				if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num)) {
+					g_free (current_comp_string);
+					continue;
+				}
+
 				span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num);
 				e_canvas_item_grab_focus (span->text_item, TRUE);
 				g_free (week_view->last_edited_comp_string);
@@ -2674,6 +2719,9 @@ tooltip_get_view_event (EWeekView *week_
 {
 	EWeekViewEvent *pevent;
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+		return NULL;
+
 	pevent = &g_array_index (week_view->events, EWeekViewEvent, event_num);
 
 	return pevent;
@@ -2772,7 +2820,17 @@ e_week_view_reshape_event_span (EWeekVie
 	PangoFontMetrics *font_metrics;
 	PangoLayout *layout;
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+		return;
+
 	event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+	if (!is_comp_data_valid (event))
+		return;
+
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+		return;
+
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 			       event->spans_index + span_num);
 	comp = e_cal_component_new ();
@@ -3042,7 +3100,17 @@ e_week_view_start_editing_event (EWeekVi
 	    && span_num == week_view->editing_span_num)
 		return TRUE;
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+		return FALSE;
+
 	event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+	if (!is_comp_data_valid (event))
+		return FALSE;
+
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+		return FALSE;
+
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 			       event->spans_index + span_num);
 
@@ -3054,7 +3122,12 @@ e_week_view_start_editing_event (EWeekVi
 		return FALSE;
 
 	if (week_view->editing_event_num >= 0) {
-		EWeekViewEvent *editing = &g_array_index (week_view->events, EWeekViewEvent, week_view->editing_event_num);
+		EWeekViewEvent *editing;
+
+		if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+			return FALSE;
+
+		editing = &g_array_index (week_view->events, EWeekViewEvent, week_view->editing_event_num);
 
 		/* do not change to other part of same component - the event is spread into more days */
 		if (editing && event && editing->comp_data == event->comp_data)
@@ -3091,6 +3164,10 @@ e_week_view_start_editing_event (EWeekVi
 		}
 		g_return_val_if_fail (event_num >= 0, FALSE);
 	}
+
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+		return FALSE;
+
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,  event->spans_index + span_num);
 
 	/* Try to move the cursor to the end of the text. */
@@ -3135,7 +3212,17 @@ cancel_editing (EWeekView *week_view)
 
 	g_return_if_fail (event_num != -1);
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+		return;
+
 	event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+	if (!is_comp_data_valid (event))
+		return;
+
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+		return;
+
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num);
 
 	/* Reset the text to what was in the component */
@@ -3191,9 +3278,15 @@ e_week_view_on_text_item_event (GnomeCan
 						       &event_num, &span_num))
 			return FALSE;
 
+		if (!is_array_index_in_bounds (week_view->events, event_num))
+			return FALSE;
+
 		event = &g_array_index (week_view->events, EWeekViewEvent,
 					event_num);
 
+		if (!is_comp_data_valid (event))
+			return FALSE;
+
 		/* if we started to editing new item on the canvas, then do not open editing dialog until it's saved,
 		   because the save of the event recalculates event numbers and you can edit different one */
 		if (!is_icalcomp_on_the_server (event->comp_data->icalcomp, event->comp_data->client))
@@ -3220,6 +3313,9 @@ e_week_view_on_text_item_event (GnomeCan
 				return FALSE;
 			}
 
+			if (!is_array_index_in_bounds (week_view->events, event_num))
+				return FALSE;
+
 			e = &g_array_index (week_view->events, EWeekViewEvent, event_num);
 
 			if (!GTK_WIDGET_HAS_FOCUS (week_view))
@@ -3357,8 +3453,14 @@ static gboolean e_week_view_event_move (
 	if (event_num == -1)
 		return FALSE;
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+ 		return FALSE;
+
 	event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
 
+	if (!is_comp_data_valid (event))
+		return FALSE;
+	
 	start_dt = event->start;
 	end_dt = event->end;
 	start_time = icalcomponent_get_dtstart (event->comp_data->icalcomp);
@@ -3470,7 +3572,14 @@ e_week_view_change_event_time (EWeekView
 	if (event_num == -1)
 		return;
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+		return;
+
 	event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+	if (!is_comp_data_valid (event))
+		return;
+
 	client = event->comp_data->client;
 
 	/* We use a temporary shallow copy of the ico since we don't want to
@@ -3577,7 +3686,17 @@ e_week_view_on_editing_stopped (EWeekVie
 	if (event_num == -1)
 		return;
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+		return;
+
 	event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+	if (!is_comp_data_valid (event))
+		return;
+
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+		return;
+
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 			       event->spans_index + span_num);
 
@@ -3725,6 +3844,9 @@ e_week_view_find_event_from_item (EWeekV
 		event = &g_array_index (week_view->events, EWeekViewEvent,
 					event_num);
 		for (span_num = 0; span_num < event->num_spans; span_num++) {
+			if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+				continue;
+
 			span = &g_array_index (week_view->spans,
 					       EWeekViewEventSpan,
 					       event->spans_index + span_num);
@@ -3767,6 +3889,9 @@ e_week_view_find_event_from_uid (EWeekVi
 		event = &g_array_index (week_view->events, EWeekViewEvent,
 					event_num);
 
+		if (!is_comp_data_valid (event))
+			continue;
+
 		if (event->comp_data->client != client)
 			continue;
 
@@ -3798,10 +3923,16 @@ e_week_view_is_one_day_event	(EWeekView
 	EWeekViewEvent *event;
 	EWeekViewEventSpan *span;
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+		return FALSE;
+
 	event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
 	if (event->num_spans != 1)
 		return FALSE;
 
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index))
+		return FALSE;
+
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 			       event->spans_index);
 
@@ -4109,8 +4240,15 @@ e_week_view_add_new_event_in_selected_ra
 		return FALSE;
 	}
 
+	if (!is_array_index_in_bounds (week_view->events, event_num))
+		return FALSE;
+
 	wvevent = &g_array_index (week_view->events, EWeekViewEvent,
 				  event_num);
+
+	if (!is_array_index_in_bounds (week_view->spans, wvevent->spans_index + 0))
+		return FALSE;
+
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 			       wvevent->spans_index + 0);
 
@@ -4497,8 +4635,15 @@ e_week_view_paste_text (ECalendarView *c
 	    !e_week_view_add_new_event_in_selected_range (week_view, NULL))
 		return;
 
+	if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+		return;
+
 	event = &g_array_index (week_view->events, EWeekViewEvent,
 				week_view->editing_event_num);
+
+	if (!is_array_index_in_bounds (week_view->spans, event->spans_index + week_view->editing_span_num))
+		return;
+
 	span = &g_array_index (week_view->spans, EWeekViewEventSpan,
 			       event->spans_index + week_view->editing_span_num);
 
Index: evolution-2.28.2/calendar/gui/print.c
===================================================================
--- evolution-2.28.2.orig/calendar/gui/print.c
+++ evolution-2.28.2/calendar/gui/print.c
@@ -1090,6 +1090,9 @@ print_day_long_event (GtkPrintContext *c
 	struct tm date_tm;
 	double red, green, blue;
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	/* If the event starts before the first day being printed, draw a
 	   triangle. (Note that I am assuming we are just showing 1 day at
 	   the moment.) */
@@ -1169,6 +1172,9 @@ print_day_event (GtkPrintContext *contex
 	struct tm date_tm;
 	double red, green, blue;
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	if ((event->start_minute >= pdi->end_minute_offset)
 	    || (event->end_minute <= pdi->start_minute_offset))
 		return;
@@ -1538,6 +1544,9 @@ print_week_event (GtkPrintContext *conte
 	double red, green, blue;
 	GdkPixbuf *pixbuf = NULL;
 
+	if (!is_comp_data_valid (event))
+		return;
+
 	text = get_summary_with_location (event->comp_data->icalcomp);
 
 	for (span_num = 0; span_num < event->num_spans; span_num++) {
Index: evolution-2.28.2/plugins/groupwise-features/process-meeting.c
===================================================================
--- evolution-2.28.2.orig/plugins/groupwise-features/process-meeting.c
+++ evolution-2.28.2/plugins/groupwise-features/process-meeting.c
@@ -199,13 +199,19 @@ process_meeting (ECalendarView *cal_view
 	selected = e_calendar_view_get_selected_events (cal_view);
 	if (selected) {
 		ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
-		ECalComponent *comp = e_cal_component_new ();
-		ReceiveData *r_data = g_new0 (ReceiveData, 1);
+		ECalComponent *comp;
+		ReceiveData *r_data;
 		gboolean recurring = FALSE;
 		GThread *thread = NULL;
 		GError *error = NULL;
 		gchar *address = NULL;
 
+		if (!is_comp_data_valid (event))
+			return;
+
+		comp = e_cal_component_new ();
+		r_data = g_new0 (ReceiveData, 1);
+
 		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 		address = itip_get_comp_attendee (comp, event->comp_data->client);
 
@@ -483,7 +489,7 @@ on_resend_meeting (EPopup *ep, EPopupIte
 	selected = e_calendar_view_get_selected_events (cal_view);
 	if (selected) {
 		ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
-		ECalComponent *comp = e_cal_component_new ();
+		ECalComponent *comp;
 		ECalComponent *new_comp = NULL;
 		gboolean recurring = FALSE;
 		CalObjModType mod = CALOBJ_MOD_THIS;
@@ -493,6 +499,10 @@ on_resend_meeting (EPopup *ep, EPopupIte
 		/* inserting the boolean to share the code between resend and retract */
 		gboolean resend = TRUE;
 
+		if (!is_comp_data_valid (event))
+			return;
+
+		comp = e_cal_component_new ();
 		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 		if (e_cal_component_has_recurrences (comp) || e_cal_component_is_instance (comp))
 			recurring = TRUE;
