summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvgstyle.cpp
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-08-19 16:21:10 +0200
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-08-20 15:19:19 +0200
commit9162508604dc05c7de2a5ea02a20369681b06456 (patch)
tree5ecef7baa30241207185a2e5d5bc87d5d40ec7ef /src/svg/qsvgstyle.cpp
parentbe6a9d6223b9a07a4563cfe63e54b93da959d8f4 (diff)
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.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index 85d257f29b..915c5125a3 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;