[evolution-data-server] Fix a crash during offline-message sync.



commit f7ba2530e30848760dcfc8ec6c04bc9bb19799e4
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Mon Mar 8 11:56:23 2010 +0530

    Fix a crash during offline-message sync.

 camel/providers/imapx/camel-imapx-server.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 4dc9e2a..8d666c4 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -3663,12 +3663,21 @@ imapx_server_get_message (CamelIMAPXServer *is, CamelFolder *folder, CamelOperat
 	QUEUE_LOCK (is);
 
 	if (imapx_is_job_in_queue (is, folder->full_name, IMAPX_JOB_GET_MESSAGE, uid)) {
-		/* TODO set a right exception */
 		camel_exception_set (ex, CAMEL_EXCEPTION_OPERATION_IN_PROGRESS, "Downloading message...");
 		QUEUE_UNLOCK (is);
 		return NULL;
 	}
 
+	mi = camel_folder_summary_uid (folder->summary, uid);
+	if (!mi) {
+		camel_exception_setv (
+				ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+				_("Cannot get message with message ID %s: %s"),
+				uid, _("No such message available."));
+		QUEUE_UNLOCK (is);
+		return NULL;
+	}
+
 	tmp_stream = camel_data_cache_add (ifolder->cache, "tmp", uid, NULL);
 
 	job = g_malloc0(sizeof(*job));
@@ -3681,7 +3690,6 @@ imapx_server_get_message (CamelIMAPXServer *is, CamelFolder *folder, CamelOperat
 	job->u.get_message.stream = tmp_stream;
 	job->ex = ex;
 
-	mi = camel_folder_summary_uid (folder->summary, uid);
 	if (((CamelMessageInfoBase *) mi)->size > MULTI_SIZE)
 		job->u.get_message.use_multi_fetch = TRUE;
 



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