diff --git a/src/array_property.rs b/src/array_property.rs index 7d36da6..93b2a3a 100644 --- a/src/array_property.rs +++ b/src/array_property.rs @@ -6,12 +6,12 @@ use binrw::{BinRead, BinResult, binrw}; fn custom_parser(size_in_bytes: u32, value_type: &str) -> BinResult> { let mut result = Vec::::new(); - let mut current = reader.stream_position().unwrap(); + let mut current = reader.stream_position()?; let end = current + size_in_bytes as u64 - 4; while current < end { - result.push(ArrayEntry::read_options(reader, endian, (value_type,)).unwrap()); - current = reader.stream_position().unwrap(); + result.push(ArrayEntry::read_options(reader, endian, (value_type,))?); + current = reader.stream_position()?; } Ok(result) } diff --git a/src/map_property.rs b/src/map_property.rs index c7d6e72..693847a 100644 --- a/src/map_property.rs +++ b/src/map_property.rs @@ -185,12 +185,12 @@ fn custom_parser( ) -> BinResult> { let mut result = Vec::::new(); - let mut current = reader.stream_position().unwrap(); + let mut current = reader.stream_position()?; let end = current + size_in_bytes as u64 - 5 - 3; while current < end { - result.push(MapEntry::read_options(reader, endian, (key_type, value_type)).unwrap()); - current = reader.stream_position().unwrap(); + result.push(MapEntry::read_options(reader, endian, (key_type, value_type))?); + current = reader.stream_position()?; } Ok(result) }