changeset 2474:d2a64ae90011 HEAD

Crashfix
author Timo Sirainen <tss@iki.fi>
date Mon, 23 Aug 2004 10:14:06 +0300
parents f4f133f84d63
children 27bea4044b93
files src/imap/cmd-idle.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-idle.c	Mon Aug 23 10:01:49 2004 +0300
+++ b/src/imap/cmd-idle.c	Mon Aug 23 10:14:06 2004 +0300
@@ -134,17 +134,19 @@
 {
 	struct cmd_idle_context *ctx = client->cmd_context;
 
-	if (imap_sync_more(ctx->sync_ctx) == 0) {
-		/* unfinished */
-		return FALSE;
-	}
+	if (ctx->sync_ctx != NULL) {
+		if (imap_sync_more(ctx->sync_ctx) == 0) {
+			/* unfinished */
+			return FALSE;
+		}
 
-	if (imap_sync_deinit(ctx->sync_ctx) < 0) {
-		client_send_untagged_storage_error(client,
-			mailbox_get_storage(client->mailbox));
-		mailbox_notify_changes(client->mailbox, 0, NULL, NULL);
+		if (imap_sync_deinit(ctx->sync_ctx) < 0) {
+			client_send_untagged_storage_error(client,
+				mailbox_get_storage(client->mailbox));
+			mailbox_notify_changes(client->mailbox, 0, NULL, NULL);
+		}
+		ctx->sync_ctx = NULL;
 	}
-	ctx->sync_ctx = NULL;
 
 	if (ctx->idle_timeout) {
 		/* outlook workaround */