diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2020-09-17 10:08:34 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-09-18 12:13:15 +0000 |
commit | 648daeb81994f95e8827fd1e76893557b3182a48 (patch) | |
tree | 1518ddca0940911c95710d96b15e62123e4006f2 | |
parent | 122d45862df0f086601f63659b9bb0936ea58c09 (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.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index a7a2e0036..42f886d3c 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); |