changeset 4717:392c7d4605be HEAD

Crashfix
author Timo Sirainen <tss@iki.fi>
date Thu, 26 Oct 2006 14:28:38 +0300
parents 79edf40cc2f9
children b0d21acf9689
files src/lib-storage/index/mbox/mbox-sync.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync.c	Thu Oct 26 03:17:23 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Thu Oct 26 14:28:38 2006 +0300
@@ -791,13 +791,17 @@
 	i_assert(mail_ctx->mail.uid == 0 || mail_ctx->mail.space > 0 ||
 		 mail_ctx->mail.offset == mail_ctx->hdr_offset);
 
-	/* mail's keywords are allocated from a pool that's cleared for each
-	   mail. we'll need to copy it to something more permanent. */
-	ARRAY_CREATE(&keywords_copy, sync_ctx->saved_keywords_pool,
-		     unsigned int, array_count(&mail_ctx->mail.keywords));
-	array_append_array(&keywords_copy, &mail_ctx->mail.keywords);
-	mail_ctx->mail.keywords = keywords_copy;
-	array_append(&sync_ctx->mails, &mail_ctx->mail, 1);
+	if (array_is_created(&mail_ctx->mail.keywords)) {
+		/* mail's keywords are allocated from a pool that's cleared
+		   for each mail. we'll need to copy it to something more
+		   permanent. */
+		ARRAY_CREATE(&keywords_copy, sync_ctx->saved_keywords_pool,
+			     unsigned int,
+			     array_count(&mail_ctx->mail.keywords));
+		array_append_array(&keywords_copy, &mail_ctx->mail.keywords);
+		mail_ctx->mail.keywords = keywords_copy;
+		array_append(&sync_ctx->mails, &mail_ctx->mail, 1);
+	}
 
 	sync_ctx->space_diff += mail_ctx->mail.space;
 	if (sync_ctx->space_diff < 0) {