]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Thread index bugfix.
authorTimo Sirainen <tss@iki.fi>
Mon, 1 Sep 2008 12:30:40 +0000 (15:30 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 1 Sep 2008 12:30:40 +0000 (15:30 +0300)
--HG--
branch : HEAD

src/lib-storage/index/index-thread.c

index ca1368e672e71f0780d982bb6b1b71d1e784980c..83e51844c844d87cccde11e4525119e03d587131 100644 (file)
@@ -432,7 +432,15 @@ static void mail_thread_cache_update_adds(struct mail_thread_mailbox *tbox,
           should already be in msgid_map. */
        msgid_map = array_get(tbox->msgid_map, &map_count);
        uids = array_get(added_uids, &uid_count);
-       i_assert(uid_count == 0 || msgid_map[j].uid <= uids[0].seq1);
+       if (uid_count == 0)
+               return;
+
+       (void)bsearch_insert_pos(&uids[0].seq1, msgid_map, map_count,
+                                sizeof(*msgid_map), msgid_map_cmp, &j);
+       i_assert(j < map_count);
+       while (j > 0 && msgid_map[j-1].uid == msgid_map[j].uid)
+               j--;
+
        for (i = 0; i < uid_count; i++) {
                for (uid = uids[i].seq1; uid <= uids[i].seq2; uid++) {
                        while (j < map_count && msgid_map[j].uid < uid)