From b0aaaad8427cacdb9486b4406198c3301569422c Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 5 Aug 2008 11:24:29 -0400 Subject: [PATCH] sort indexes: One more assert-crashfix when renumbering sort IDs. --HG-- branch : HEAD --- src/lib-storage/index/index-sort-string.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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; } } -- 2.47.3