diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-08-19 14:21:10 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-08-20 13:19:19 (GMT) |
commit | 9162508604dc05c7de2a5ea02a20369681b06456 (patch) | |
tree | 5ecef7baa30241207185a2e5d5bc87d5d40ec7ef /src/svg/qsvgstyle.cpp | |
parent | be6a9d6223b9a07a4563cfe63e54b93da959d8f4 (diff) | |
download | Qt-9162508604dc05c7de2a5ea02a20369681b06456.zip Qt-9162508604dc05c7de2a5ea02a20369681b06456.tar.gz Qt-9162508604dc05c7de2a5ea02a20369681b06456.tar.bz2 |
Fixed crash in QtSvg caused by division by zero in animation code.
Reviewed-by: Trond
Diffstat (limited to 'src/svg/qsvgstyle.cpp')
-rw-r--r-- | src/svg/qsvgstyle.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index 85d257f..915c512 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -658,11 +658,14 @@ void QSvgAnimateTransform::resolveMatrix(QSvgNode *node) if (totalTimeElapsed < m_from || m_finished) return; - qreal animationFrame = (totalTimeElapsed - m_from) / m_to; + qreal animationFrame = 0; + if (m_totalRunningTime != 0) { + animationFrame = (totalTimeElapsed - m_from) / m_totalRunningTime; - if (m_repeatCount >= 0 && m_repeatCount < animationFrame) { - m_finished = true; - animationFrame = m_repeatCount; + if (m_repeatCount >= 0 && m_repeatCount < animationFrame) { + m_finished = true; + animationFrame = m_repeatCount; + } } qreal percentOfAnimation = animationFrame; |