[evolution/gnome-2-28] Bug #565582 - Make sure the comp_data is not NULL before using it



commit 499b0ef94e4f128018c76bb86b0f76203f302458
Author: Thomas Mittelstaedt <tmstaedt t-mittelstaedt de>
Date:   Fri Jan 8 16:41:27 2010 +0100

    Bug #565582 - Make sure the comp_data is not NULL before using it

 calendar/gui/e-cal-menu.c  |    6 +++---
 calendar/gui/e-cal-popup.c |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/calendar/gui/e-cal-menu.c b/calendar/gui/e-cal-menu.c
index 30d287f..0d8c579 100644
--- a/calendar/gui/e-cal-menu.c
+++ b/calendar/gui/e-cal-menu.c
@@ -121,8 +121,9 @@ e_cal_menu_target_new_select(ECalMenu *eabp, struct _ECalModel *model, GPtrArray
 {
 	ECalMenuTargetSelect *t = e_menu_target_new(&eabp->menu, E_CAL_MENU_TARGET_SELECT, sizeof(*t));
 	guint32 mask = ~0;
-	ECal *client;
+	ECal *client = NULL;
 	gboolean read_only;
+	ECalModelComponent *comp_data = NULL;
 
 	/* FIXME: This is duplicated in e-cal-popup */
 
@@ -132,8 +133,7 @@ e_cal_menu_target_new_select(ECalMenu *eabp, struct _ECalModel *model, GPtrArray
 
 	if (t->events->len == 0) {
 		client = e_cal_model_get_default_client(t->model);
-	} else {
-		ECalModelComponent *comp_data = (ECalModelComponent *)t->events->pdata[0];
+	} else if ((comp_data = (ECalModelComponent *)t->events->pdata[0]) != NULL) {
 
 		mask &= ~E_CAL_MENU_SELECT_ANY;
 		if (t->events->len == 1)
diff --git a/calendar/gui/e-cal-popup.c b/calendar/gui/e-cal-popup.c
index cdbce07..94f4242 100644
--- a/calendar/gui/e-cal-popup.c
+++ b/calendar/gui/e-cal-popup.c
@@ -219,8 +219,9 @@ e_cal_popup_target_new_select(ECalPopup *eabp, struct _ECalModel *model, GPtrArr
 {
 	ECalPopupTargetSelect *t = e_popup_target_new(&eabp->popup, E_CAL_POPUP_TARGET_SELECT, sizeof(*t));
 	guint32 mask = ~0;
-	ECal *client;
+	ECal *client = NULL;
 	gboolean read_only, user_org = FALSE;
+	ECalModelComponent *comp_data = NULL;
 
 	/* FIXME: This is duplicated in e-cal-menu */
 
@@ -230,8 +231,7 @@ e_cal_popup_target_new_select(ECalPopup *eabp, struct _ECalModel *model, GPtrArr
 
 	if (t->events->len == 0) {
 		client = e_cal_model_get_default_client(t->model);
-	} else {
-		ECalModelComponent *comp_data = (ECalModelComponent *)t->events->pdata[0];
+	} else if ((comp_data = (ECalModelComponent *)t->events->pdata[0]) != NULL) {
 		ECalComponent *comp;
 		gchar *user_email = NULL;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]