Closed
Description
Bevy version
bevy 0.10.1
What you did
I set a repeating timers duration to 0. I did so accidentally using the egui_inspector, but is also reproducible if setting it via code.
What went wrong
Bevy panicked, because it can't divide by 0.
thread 'Compute Task Pool (3)' panicked at 'attempt to divide by zero', C:<redacted>.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_time-0.10.1\src\timer.rs:228:21
Caused by this line of code:
self.times_finished_this_tick =
(self.elapsed().as_nanos() / self.duration().as_nanos()) as u32;```
## Additional information
While in my case it happened for a repeating timer, similar panics can and will happen if for example the percent function of the timer is used, while the duration is set to 0.
Activity