changeset 14921:e33fe1a7bb89

lib-index: Fixed assert-crash on some error conditions.
author Timo Sirainen <tss@iki.fi>
date Fri, 22 Feb 2013 15:49:35 +0200
parents 0a932ba1f01f
children cd413ab7aeb3
files src/lib-index/mail-transaction-log-file.c
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-file.c	Fri Feb 22 14:49:27 2013 +0200
+++ b/src/lib-index/mail-transaction-log-file.c	Fri Feb 22 15:49:35 2013 +0200
@@ -1683,7 +1683,7 @@
 	}
 
 	if (MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file)) {
-		if (start_offset < file->buffer_offset) {
+		if (start_offset < file->buffer_offset || file->buffer == NULL) {
 			/* we had moved the log to memory but failed to read
 			   the beginning of the log file */
 			mail_index_set_error(index,
@@ -1691,7 +1691,6 @@
 				file->filepath);
 			return 0;
 		}
-		i_assert(file->buffer != NULL);
 		return log_file_map_check_offsets(file, start_offset,
 						  end_offset);
 	}