changeset 1835:3dac992e11e0 HEAD

header fix
author Timo Sirainen <tss@iki.fi>
date Tue, 21 Oct 2003 14:10:05 +0300
parents 6cfa2a123b7e
children 36ae8c2e5791
files src/lib-index/mail-cache.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-cache.c	Tue Oct 21 08:27:57 2003 +0300
+++ b/src/lib-index/mail-cache.c	Tue Oct 21 14:10:05 2003 +0300
@@ -787,6 +787,7 @@
 
 	/* headers could have changed, reread them */
 	memset(cache->split_offsets, 0, sizeof(cache->split_offsets));
+	memset(cache->split_headers, 0, sizeof(cache->split_headers));
 
 	if (ret) {
 		cache->index->header->flags &=
@@ -1363,7 +1364,7 @@
 {
 	struct mail_cache *cache = ctx->cache;
 	uint32_t offset, update_offset, size;
-	const char *header_str;
+	const char *header_str, *prev_str;
 
 	i_assert(*headers != NULL);
 	i_assert(idx < MAIL_CACHE_HEADERS_COUNT);
@@ -1373,9 +1374,13 @@
 	t_push();
 
 	header_str = write_header_string(headers, &size);
-	i_assert(idx == 0 ||
-		 strcmp(mail_cache_get_header_fields_str(cache, idx-1),
-			header_str) != 0);
+	if (idx != 0) {
+		prev_str = mail_cache_get_header_fields_str(cache, idx-1);
+		if (prev_str == NULL)
+			return FALSE;
+
+		i_assert(strcmp(header_str, prev_str) != 0);
+	}
 
 	offset = mail_cache_append_space(ctx, size + sizeof(uint32_t));
 	if (offset != 0) {