evolution r36579 - trunk/plugins/exchange-operations



Author: mcrha
Date: Wed Oct  8 18:22:50 2008
New Revision: 36579
URL: http://svn.gnome.org/viewvc/evolution?rev=36579&view=rev

Log:
2008-10-08  Milan Crha  <mcrha redhat com>

	** Fix for bug #530606

	* exchange-contacts.c: (e_exchange_contacts_get_contacts),
	(e_exchange_contacts_pcontacts_on_change),
	(e_exchange_contacts_pcontacts), (e_exchange_contacts_check),
	(e_exchange_contacts_commit):
	* exchange-account-setup.c: (btn_chpass_clicked), (btn_dass_clicked),
	(btn_fsize_clicked), (org_gnome_exchange_show_folder_size_factory):
	* exchange-calendar.c: (e_exchange_calendar_get_calendars),
	(e_exchange_calendar_pcalendar_on_change),
	(e_exchange_calendar_pcalendar), (e_exchange_calendar_check),
	(e_exchange_calendar_commit):
	Check validity of returned pointer before using it.



Modified:
   trunk/plugins/exchange-operations/ChangeLog
   trunk/plugins/exchange-operations/exchange-account-setup.c
   trunk/plugins/exchange-operations/exchange-calendar.c
   trunk/plugins/exchange-operations/exchange-contacts.c

Modified: trunk/plugins/exchange-operations/exchange-account-setup.c
==============================================================================
--- trunk/plugins/exchange-operations/exchange-account-setup.c	(original)
+++ trunk/plugins/exchange-operations/exchange-account-setup.c	Wed Oct  8 18:22:50 2008
@@ -123,6 +123,8 @@
  	ExchangeAccountResult result;
 
 	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return;
 
 	old_password = exchange_account_get_password (account);
 	if (!old_password) {
@@ -149,6 +151,8 @@
 {
 	ExchangeAccount *account;
 	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return;
 	exchange_delegates (account, gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW));
 }
 
@@ -159,6 +163,8 @@
 	GtkListStore *model;
 
 	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return;
 
 	model = exchange_account_folder_size_get_model (account);
 	if (model)
@@ -1050,7 +1056,10 @@
 	if (g_ascii_strcasecmp (provider->protocol, "exchange"))
 		return NULL;
 
-	account = exchange_operations_get_exchange_account ();  
+	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return NULL;
+
 	exchange_account_is_offline (account, &mode);  
 	if (mode == OFFLINE_MODE)  
 		return NULL;  

Modified: trunk/plugins/exchange-operations/exchange-calendar.c
==============================================================================
--- trunk/plugins/exchange-operations/exchange-calendar.c	(original)
+++ trunk/plugins/exchange-operations/exchange-calendar.c	Wed Oct  8 18:22:50 2008
@@ -81,6 +81,8 @@
 	}
 
 	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return NULL;
 
 	/* FIXME: Reconsider this hardcoding */
 	uri_prefix = g_strconcat ("exchange://", account->account_filename, "/;", NULL);
@@ -121,6 +123,8 @@
 	gchar *es_ruri, *ruri;
 
 	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return;
 
 	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
 	gtk_tree_selection_get_selected(selection, &model, &iter);
@@ -249,9 +253,12 @@
 
 	callist = e_exchange_calendar_get_calendars (t->source_type);
 
-	for (i=0; i<callist->len; ++i) {
-		ruri = g_ptr_array_index (callist, i);
-		exchange_operations_cta_add_node_to_tree (ts_pcalendar, NULL, ruri);
+	if (callist) {
+		for (i = 0; i < callist->len; i++) {
+			ruri = g_ptr_array_index (callist, i);
+			exchange_operations_cta_add_node_to_tree (ts_pcalendar, NULL, ruri);
+		}
+		g_ptr_array_free (callist, TRUE);
 	}
 
 	cr_calendar = gtk_cell_renderer_text_new ();
@@ -296,7 +303,6 @@
 		g_free (sruri);
 	}
 
-	g_ptr_array_free (callist, TRUE);
 	g_object_unref (ts_pcalendar);
 	return tv_pcalendar;
 }
@@ -337,6 +343,9 @@
         }
 
 	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return FALSE;
+
 	uri_text = e_source_get_uri (t->source);
 	euri = e_uri_new (uri_text);
 	uri_string = e_uri_to_string (euri, FALSE);
@@ -392,7 +401,7 @@
 	}
 
 	account = exchange_operations_get_exchange_account ();
-	if (!is_exchange_personal_folder (account, uri_text))
+	if (!account || !is_exchange_personal_folder (account, uri_text))
 		return;
 
 	windows_domain = exchange_account_get_windows_domain (account);

Modified: trunk/plugins/exchange-operations/exchange-contacts.c
==============================================================================
--- trunk/plugins/exchange-operations/exchange-contacts.c	(original)
+++ trunk/plugins/exchange-operations/exchange-contacts.c	Wed Oct  8 18:22:50 2008
@@ -70,6 +70,8 @@
 	gchar *uri_prefix, *ruri;
 
 	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return NULL;
 
 	uri_prefix = g_strconcat ("exchange://", account->account_filename, "/;", NULL);
 	prefix_len = strlen (uri_prefix);
@@ -108,6 +110,8 @@
 	gchar *ruri;
 
 	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return;
 
 	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
 	gtk_tree_selection_get_selected(selection, &model, &iter);
@@ -241,9 +245,12 @@
 
 	conlist = e_exchange_contacts_get_contacts ();
 
-	for (i=0; i<conlist->len; ++i) {
-		ruri = g_ptr_array_index (conlist, i);
-		exchange_operations_cta_add_node_to_tree (ts_pcontacts, NULL, ruri);
+	if (conlist) {
+		for (i = 0; i < conlist->len; i++) {
+			ruri = g_ptr_array_index (conlist, i);
+			exchange_operations_cta_add_node_to_tree (ts_pcontacts, NULL, ruri);
+		}
+		g_ptr_array_free (conlist, TRUE);
 	}
 
 	cr_contacts = gtk_cell_renderer_text_new ();
@@ -293,7 +300,6 @@
 		g_free (sruri);
 	}
 
-	g_ptr_array_free (conlist, TRUE);
 	g_object_unref (ts_pcontacts);
 	return vb_pcontacts;
 }
@@ -329,6 +335,8 @@
 	}
 
 	account = exchange_operations_get_exchange_account ();
+	if (!account)
+		return FALSE;
 
 	if (!rel_uri) {
 		GConfClient *client;
@@ -424,7 +432,7 @@
 	}
 
 	account = exchange_operations_get_exchange_account ();
-	if (!is_exchange_personal_folder (account, uri_text))
+	if (!account || !is_exchange_personal_folder (account, uri_text))
 		return;
 
 	windows_domain = exchange_account_get_windows_domain (account);



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