rec = view->map->records;
- idx = 0;
- left_idx = *left_idx_p;
+ idx = left_idx = *left_idx_p;
right_idx = view->map->records_count;
while (left_idx < right_idx) {
break;
}
+ if (idx == view->map->records_count) {
+ /* no messages available */
+ return 0;
+ }
+
*left_idx_p = left_idx;
if (rec[idx].uid != uid) {
if (nearest_side > 0) {
return -1;
}
+ if (hdr->messages_count == 0) {
+ ctx->seq1 = 1;
+ ctx->seq2 = 0;
+ return 0;
+ }
+
if (search_parse_msgset_args(ctx->ibox, hdr, args,
&ctx->seq1, &ctx->seq2) < 0)
return -1;