From 27788de9e82a55efb3cdf289abf35a3ea19968c4 Mon Sep 17 00:00:00 2001 From: thebluefish Date: Mon, 17 Oct 2022 16:42:34 +0000 Subject: [PATCH] Fix end-of-animation index OOB (#6210) # Objective Fixes #6204 ## Solution Added another branch to handle end-of-animation special case --- crates/bevy_animation/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index 8dbf71e7faadc..8d7cfa9925557 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -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