changeset 4436:2b7254c5809c HEAD

We assert-crashed in wrong conditions.
author Timo Sirainen <tss@iki.fi>
date Sat, 24 Jun 2006 23:54:35 +0300
parents ccd102aef7ad
children a0066aa9678b
files src/lib-storage/index/mbox/mbox-sync-rewrite.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Sat Jun 24 23:53:37 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Sat Jun 24 23:54:35 2006 +0300
@@ -395,9 +395,11 @@
 			return -1;
 	}
 
-	need_space = str_len(mail_ctx->header) - mail_ctx->mail.space -
-		(mail_ctx->body_offset - mail_ctx->hdr_offset);
-	i_assert(need_space == (uoff_t)-mails[idx].space);
+	if (mail_ctx->mail.space <= 0) {
+		need_space = str_len(mail_ctx->header) - mail_ctx->mail.space -
+			(mail_ctx->body_offset - mail_ctx->hdr_offset);
+		i_assert(need_space == (uoff_t)-mails[idx].space);
+	}
 
 	if (mails[idx].space == 0) {
 		/* don't touch spacing */