# HG changeset patch # User Timo Sirainen # Date 1264962565 -7200 # Node ID 2893ca172707945416d34466b17903d45a78848e # Parent 8dcfb629a060b2d7d4a385787dcd05db9f01dbf0 mail_index_update_flags_range(): Fixed merging last update. diff -r 8dcfb629a060 -r 2893ca172707 src/lib-index/mail-index-transaction-update.c --- 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) {