changeset 2681:d6c8faedc775 HEAD

Give error message instead of crashing if mbox offset is lost.
author Timo Sirainen <tss@iki.fi>
date Sun, 03 Oct 2004 15:32:01 +0300
parents 48df7f95fa4a
children f25f48725d95
files src/lib-storage/index/mbox/mbox-file.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-file.c	Sun Oct 03 15:28:57 2004 +0300
+++ b/src/lib-storage/index/mbox/mbox-file.c	Sun Oct 03 15:32:01 2004 +0300
@@ -108,6 +108,14 @@
 		return -1;
 	}
 
+	if (data == NULL) {
+		mail_storage_set_critical(ibox->box.storage,
+			"Cached message offset lost for seq %u in mbox file %s",
+			seq, ibox->path);
+		mail_index_mark_corrupted(ibox->index);
+		return -1;
+	}
+
 	offset = *((const uint64_t *)data);
 	if (istream_raw_mbox_seek(ibox->mbox_stream, offset) < 0) {
 		if (offset == 0) {