From 22a594d46567d3589605d5fee3a31faa8dc10438 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Thu, 17 Sep 2020 10:08:34 +0200 Subject: evaluateClipAtLocalTime: prevent negative indices for keyframes lookup Change-Id: I811c1a7334674d670f42eb46195e2e0e23b690f3 Reviewed-by: Mike Krus (cherry picked from commit 0731f8b336a6792e344dfefad8b7e9c79afac2d2) Reviewed-by: Qt Cherry-pick Bot --- src/animation/backend/animationutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index a5656e230..7e21cba3a 100644 --- a/src/animation/backend/animationutils.cpp +++ b/src/animation/backend/animationutils.cpp @@ -277,7 +277,7 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime) return quat; }; - const int lowerKeyframeBound = channel.channelComponents[0].fcurve.lowerKeyframeBound(localTime); + const int lowerKeyframeBound = std::max(0, channel.channelComponents[0].fcurve.lowerKeyframeBound(localTime)); const auto lowerQuat = quaternionFromChannel(lowerKeyframeBound); const auto higherQuat = quaternionFromChannel(lowerKeyframeBound + 1); auto cosHalfTheta = QQuaternion::dotProduct(lowerQuat, higherQuat); -- cgit v1.2.3