]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
sort indexes: One more assert-crashfix when renumbering sort IDs.
authorTimo Sirainen <tss@iki.fi>
Tue, 5 Aug 2008 15:24:29 +0000 (11:24 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 5 Aug 2008 15:24:29 +0000 (11:24 -0400)
--HG--
branch : HEAD

src/lib-storage/index/index-sort-string.c

index 12ad0902eb9e1e2f065903614f4dec0c22204c53..17a839e592a161eb5792292f44d591ff00bdeb19 100644 (file)
@@ -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;
                        }
                }