Skip to content

Commit edaf851

Browse files
committed
Fix the end split of ChunksProducer too
1 parent 2f8e59c commit edaf851

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/slice/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ impl<'data, T: 'data + Sync> Producer for ChunksProducer<'data, T> {
571571
}
572572

573573
fn split_at(self, index: usize) -> (Self, Self) {
574-
let elem_index = index * self.chunk_size;
574+
let elem_index = cmp::min(index * self.chunk_size, self.slice.len());
575575
let (left, right) = self.slice.split_at(elem_index);
576576
(
577577
ChunksProducer {

0 commit comments

Comments
 (0)