summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-09-17 10:08:34 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-09-18 12:13:15 +0000
commit22a594d46567d3589605d5fee3a31faa8dc10438 (patch)
treef4271796fd9d24c58682232b4f4315520e36c1d7
parent5451edeb79cc0c9816220fb60f9c6f0ba275fa02 (diff)
evaluateClipAtLocalTime: prevent negative indices for keyframes lookup
Change-Id: I811c1a7334674d670f42eb46195e2e0e23b690f3 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 0731f8b336a6792e344dfefad8b7e9c79afac2d2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/animation/backend/animationutils.cpp2
1 files changed, 1 insertions, 1 deletions
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);