summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-09-17 10:08:34 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-09-18 12:37:44 +0200
commit0731f8b336a6792e344dfefad8b7e9c79afac2d2 (patch)
tree68c3ad5933cbfd0da2b17eb464693384e01d1462
parent3756223ea201184cd493671abb72fb548c0c8275 (diff)
evaluateClipAtLocalTime: prevent negative indices for keyframes lookup
Pick-to: 5.15 Pick-to: 5.12 Change-Id: I811c1a7334674d670f42eb46195e2e0e23b690f3 Reviewed-by: Mike Krus <mike.krus@kdab.com>
-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 2c0c5cb6d..b44b467de 100644
--- a/src/animation/backend/animationutils.cpp
+++ b/src/animation/backend/animationutils.cpp
@@ -270,7 +270,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);