aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-week-view-event-item.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-05-14 05:49:58 +0800
committerMilan Crha <mcrha@redhat.com>2010-05-14 05:49:58 +0800
commit5a124a6add633ba4af8babc8de7a8a9b8058899e (patch)
tree9fd9c187c4ac640eeb10c8586c90c3b9c5ec7380 /calendar/gui/e-week-view-event-item.c
parentb936a2301feb69f420d930f8f74436dde35b9f04 (diff)
downloadgsoc2013-evolution-5a124a6add633ba4af8babc8de7a8a9b8058899e.tar.gz
gsoc2013-evolution-5a124a6add633ba4af8babc8de7a8a9b8058899e.tar.zst
gsoc2013-evolution-5a124a6add633ba4af8babc8de7a8a9b8058899e.zip
Bug #607257 - Add checks for event->comp_data != NULL
Diffstat (limited to 'calendar/gui/e-week-view-event-item.c')
-rw-r--r--calendar/gui/e-week-view-event-item.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 5d3fefaaee..ba44b7a24a 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -132,13 +132,22 @@ week_view_event_item_double_click (EWeekViewEventItem *event_item,
week_view = E_WEEK_VIEW (parent);
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return TRUE;
+
event = &g_array_index (
week_view->events, EWeekViewEvent,
event_item->priv->event_num);
+ if (!is_comp_data_valid (event))
+ return TRUE;
+
if (week_view->editing_event_num >= 0) {
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);
@@ -147,6 +156,7 @@ week_view_event_item_double_click (EWeekViewEventItem *event_item,
* on the component, which is not on the server. */
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,
@@ -182,8 +192,15 @@ week_view_event_item_button_press (EWeekViewEventItem *event_item,
week_view = E_WEEK_VIEW (parent);
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return FALSE;
+
event = &g_array_index (week_view->events, EWeekViewEvent,
event_item->priv->event_num);
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + event_item->priv->span_num))
+ return FALSE;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + event_item->priv->span_num);
@@ -390,8 +407,15 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
parent = gtk_widget_get_parent (GTK_WIDGET (canvas));
week_view = E_WEEK_VIEW (parent);
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return;
+
event = &g_array_index (week_view->events, EWeekViewEvent,
event_item->priv->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));
@@ -510,9 +534,15 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item,
parent = gtk_widget_get_parent (GTK_WIDGET (canvas));
week_view = E_WEEK_VIEW (parent);
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return;
+
event = &g_array_index (week_view->events, EWeekViewEvent,
event_item->priv->event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
cr = gdk_cairo_create (drawable);
points[0].x = x;
@@ -716,13 +746,22 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
g_return_if_fail (event_item->priv->event_num < week_view->events->len);
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return;
+
event = &g_array_index (week_view->events, EWeekViewEvent,
event_item->priv->event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
g_return_if_fail (
event->spans_index + event_item->priv->span_num <
week_view->spans->len);
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + event_item->priv->span_num))
+ return;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + event_item->priv->span_num);