Convert panic to error for writing wrong size strip
This commit is contained in:
1 parent
334759b08d
commit
496a2f31cf
1 file changed
+5
-1
+5
-1
@@ -474,7 +474,11 @@ impl<'a, W: Write + Seek, T: ColorType> ImageEncoder<'a, W, T> {
|
||||
{
|
||||
// TODO: Compression
|
||||
let samples = self.next_strip_sample_count();
|
||||
assert_eq!(value.len() as u64, samples);
|
||||
if value.len() as u64 != samples {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::InvalidData,
|
||||
"Slice is wrong size for strip").into());
|
||||
}
|
||||
|
||||
let offset = self.encoder.write_data(value)?;
|
||||
self.strip_offsets.push(offset as u32);
|
||||
|
||||
Reference in new issue
Block a user