Hopefully fix NaN issue in sync speed (#701)

This commit is contained in:
Paul Hauner 2019-12-11 11:02:54 +11:00 committed by GitHub
parent 8e7b737912
commit 8a62f3f456
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -297,7 +297,7 @@ impl Speedo {
let (prev_slot, _) = self.0.last()?; let (prev_slot, _) = self.0.last()?;
let slots_per_second = self.slots_per_second()?; let slots_per_second = self.slots_per_second()?;
if target_slot > *prev_slot { if target_slot > *prev_slot && slots_per_second > 0.0 {
let distance = (target_slot - *prev_slot).as_u64() as f64; let distance = (target_slot - *prev_slot).as_u64() as f64;
Some(distance / slots_per_second) Some(distance / slots_per_second)
} else { } else {