Skip to content

Commit

Permalink
Fix end-of-animation index OOB (bevyengine#6210)
Browse files Browse the repository at this point in the history
# Objective

Fixes bevyengine#6204

## Solution

Added another branch to handle end-of-animation special case
  • Loading branch information
thebluefish authored and james7132 committed Oct 19, 2022
1 parent b7b2395 commit 27788de
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crates/bevy_animation/src/lib.rs
Expand Up @@ -243,6 +243,7 @@ pub fn animation_player(
.keyframe_timestamps
.binary_search_by(|probe| probe.partial_cmp(&elapsed).unwrap())
{
Ok(n) if n >= curve.keyframe_timestamps.len() - 1 => continue, // this curve is finished
Ok(i) => i,
Err(0) => continue, // this curve isn't started yet
Err(n) if n > curve.keyframe_timestamps.len() - 1 => continue, // this curve is finished
Expand Down

0 comments on commit 27788de

Please sign in to comment.