changeset 10618:2893ca172707 HEAD

mail_index_update_flags_range(): Fixed merging last update.
author Timo Sirainen <tss@iki.fi>
date Sun, 31 Jan 2010 20:29:25 +0200
parents 8dcfb629a060
children 357995a6c270
files src/lib-index/mail-index-transaction-update.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-transaction-update.c	Sun Jan 31 19:15:39 2010 +0200
+++ b/src/lib-index/mail-index-transaction-update.c	Sun Jan 31 20:29:25 2010 +0200
@@ -522,8 +522,8 @@
 
 	/* merge everything */
 	idx = first_idx == 0 ? 0 : first_idx - 1;
-	max = I_MIN(t->last_update_idx + 1, count);
-	for (; idx+1 < max; ) {
+	max = count == 0 ? 0 : I_MIN(t->last_update_idx + 1, count-1);
+	for (; idx < max; ) {
 		if (updates[idx].uid2 + 1 == updates[idx+1].uid1 &&
 		    updates[idx].add_flags == updates[idx+1].add_flags &&
 		    updates[idx].remove_flags == updates[idx+1].remove_flags) {