Skip to content

Commit

Permalink
chore: 🤖 always return a valid start_time
Browse files Browse the repository at this point in the history
  • Loading branch information
theashraf committed Jan 30, 2024
1 parent e4973a3 commit 5e6d41a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dotlottie-rs/src/dotlottie_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,11 @@ impl DotLottieRuntime {
};

// update start_time to account for the already elapsed time
self.start_time = Instant::now() - Duration::from_secs_f32(elapsed_time_for_frame);
self.start_time =
match Instant::now().checked_sub(Duration::from_secs_f32(elapsed_time_for_frame)) {
Some(start_time) => start_time,
None => Instant::now(),
};
}

pub fn set_frame(&mut self, no: f32) -> bool {
Expand Down

0 comments on commit 5e6d41a

Please sign in to comment.