Skip to content

Commit

Permalink
fix TempFdArrayIterator next panic
Browse files Browse the repository at this point in the history
  • Loading branch information
b41sh committed Aug 3, 2024
1 parent 4939f73 commit 13b8ac4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ impl<'a, T> Iterator for TempFdArrayIterator<'a, T> {
Some(&self.buffer[self.index - 1])
} else {
let length = self.file_vec.len() / std::mem::size_of::<T>();
if length == 0 {
return None;
}
let ts =
unsafe { std::slice::from_raw_parts(self.file_vec.as_ptr() as *const T, length) };
if self.index - self.buffer.len() < ts.len() {
Expand Down

0 comments on commit 13b8ac4

Please sign in to comment.