Skip to content

Commit

Permalink
the read_f function now returns value.or(Ok(0.0)) instead of panicing…
Browse files Browse the repository at this point in the history
… when the value is invalid (#88)

* reading an invalid f64 now returns 0.0

* fixed code according to previous pull request's suggestions
  • Loading branch information
raisfeld-ori authored Dec 29, 2024
1 parent fe17693 commit b140ebb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dxb_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ impl<T: Read> DxbReader<T> {
Ok(value)
}
fn read_f(&mut self) -> DxfResult<f64> {
let value = read_f64(&mut self.reader)?;
let value = read_f64(&mut self.reader);
self.advance_offset(8);
Ok(value)
Ok(value.or::<f64>(Ok(0.0)).unwrap())
}
fn read_n(&mut self) -> DxfResult<f64> {
if self.is_integer_mode {
Expand Down

0 comments on commit b140ebb

Please sign in to comment.