From 9162508604dc05c7de2a5ea02a20369681b06456 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 19 Aug 2009 16:21:10 +0200 Subject: Fixed crash in QtSvg caused by division by zero in animation code. Reviewed-by: Trond --- src/svg/qsvgstyle.cpp | 11 +++++++---- 1 file 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; -- cgit v0.12