summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-07-05 13:42:40 +0200
committerSean Harmer <sean.harmer@kdab.com>2017-07-05 14:34:01 +0000
commitb891cf66a3d29b0b5245f07e40428b8778ebc051 (patch)
treeb18c6836032e66b383184590369af10837ebc0a6 /src/animation
parent83cff579d188b60ab5e81e6a4e1de449ac6bc387 (diff)
Avoid crashing when there is one single keyframe
Change-Id: Ibb98f9ab222acdd47ebdf7d2d6ca8639ed7681c1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/backend/fcurve.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/animation/backend/fcurve.cpp b/src/animation/backend/fcurve.cpp
index 4a2cf30fd..4db5d2169 100644
--- a/src/animation/backend/fcurve.cpp
+++ b/src/animation/backend/fcurve.cpp
@@ -61,6 +61,8 @@ float FCurve::evaluateAtTime(float localTime) const
} else {
// Find keyframes that sandwich the requested localTime
const int idx = m_rangeFinder.findLowerBound(localTime);
+ if (idx < 0) // only one keyframe
+ return m_keyframes.first().value;
const float t0 = m_localTimes[idx];
const float t1 = m_localTimes[idx + 1];