From: Timo Sirainen Date: Tue, 5 Aug 2008 15:24:29 +0000 (-0400) Subject: sort indexes: One more assert-crashfix when renumbering sort IDs. X-Git-Tag: 1.2.alpha1~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0aaaad8427cacdb9486b4406198c3301569422c;p=thirdparty%2Fdovecot%2Fcore.git sort indexes: One more assert-crashfix when renumbering sort IDs. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/index-sort-string.c b/src/lib-storage/index/index-sort-string.c index 12ad0902eb..17a839e592 100644 --- a/src/lib-storage/index/index-sort-string.c +++ b/src/lib-storage/index/index-sort-string.c @@ -516,11 +516,14 @@ index_sort_add_ids_range(struct sort_string_context *ctx, /* we most likely don't have enough space. we have to renumber some of the existing sort IDs. do this by widening the area we're giving sort IDs. */ - if (left_idx > 0) { - left_sort_id = nodes[--left_idx].sort_id; - if (left_sort_id == 0) { - i_assert(left_idx == 0); - left_sort_id = 1; + while (left_idx > 0) { + if (nodes[--left_idx].sort_id != left_sort_id) { + left_sort_id = nodes[left_idx].sort_id; + if (left_sort_id == 0) { + i_assert(left_idx == 0); + left_sort_id = 1; + } + break; } }