Skip to content

Commit 9db797e

Browse files
committed
qmdb/sync/gaps: clamp checked_add to range.end instead of unwrap-panic
Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
1 parent 52f31c8 commit 9db797e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

storage/src/qmdb/sync/gaps.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ pub fn find_next<'a, F: Family>(
4040
let mut fetched_ops_iter = fetched_operations
4141
.iter()
4242
.map(|(&start_loc, &operation_count)| {
43-
let end_loc = start_loc.checked_add(operation_count).unwrap();
43+
let end_loc = start_loc.checked_add(operation_count).unwrap_or(range.end);
4444
start_loc..end_loc
4545
})
4646
.peekable();
4747

4848
let mut outstanding_reqs_iter = outstanding_requests
4949
.into_iter()
5050
.map(|&start_loc| {
51-
let end_loc = start_loc.checked_add(fetch_batch_size.get()).unwrap();
51+
let end_loc = start_loc.checked_add(fetch_batch_size.get()).unwrap_or(range.end);
5252
start_loc..end_loc
5353
})
5454
.peekable();

0 commit comments

Comments
 (0)