[evolution-ews/gnome-3-4] Bug #665986 - Crash when failed to get a message from a server



commit 959c78e20ca41244ef9a218f8135389ad8d7093e
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 24 20:08:34 2012 +0200

    Bug #665986 - Crash when failed to get a message from a server

 src/camel/camel-ews-folder.c  |    2 +-
 src/server/e-ews-connection.c |   25 +++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index a7cb381..2b5c460 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -447,7 +447,7 @@ camel_ews_folder_get_message (CamelFolder *folder,
 					  cancellable, &local_error);
 	g_free (mime_dir);
 
-	if (!res) {
+	if (!res || !items) {
 		camel_ews_store_maybe_disconnect (ews_store, local_error);
 		g_propagate_error (error, local_error);
 		goto exit;
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 72a92c0..ab528f8 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -2892,6 +2892,11 @@ e_ews_connection_get_items_finish (EEwsConnection *cnc,
 	if (g_simple_async_result_propagate_error (simple, error))
 		return FALSE;
 
+	if (!async_data->items) {
+		g_set_error_literal (error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_ITEMNOTFOUND, _("No items found"));
+		return FALSE;
+	}
+
 	*items = async_data->items;
 
 	return TRUE;
@@ -3254,9 +3259,14 @@ e_ews_connection_update_items_finish (EEwsConnection *cnc,
 
 	if (g_simple_async_result_propagate_error (simple, error))
 		return FALSE;
-	if (ids)
+	if (ids) {
+		if (!async_data->items) {
+			g_set_error_literal (error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_ITEMNOTFOUND, _("No items found"));
+			return FALSE;
+		}
+
 		*ids = async_data->items;
-	else {
+	} else {
 		while (async_data->items) {
 			g_object_unref (async_data->items->data);
 			async_data->items = g_slist_remove (async_data->items,
@@ -3377,6 +3387,12 @@ e_ews_connection_create_items_finish (EEwsConnection *cnc,
 
 	if (g_simple_async_result_propagate_error (simple, error))
 		return FALSE;
+
+	if (!async_data->items) {
+		g_set_error_literal (error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_ITEMNOTFOUND, _("No items found"));
+		return FALSE;
+	}
+
 	*ids = async_data->items;
 
 	return TRUE;
@@ -4285,6 +4301,11 @@ e_ews_connection_move_items_finish (EEwsConnection *cnc,
 	if (g_simple_async_result_propagate_error (simple, error))
 		return FALSE;
 
+	if (!async_data->items) {
+		g_set_error_literal (error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_ITEMNOTFOUND, _("No items found"));
+		return FALSE;
+	}
+
 	*items = async_data->items;
 
 	return TRUE;



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