summaryrefslogtreecommitdiffstats
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-19 16:31:03 +0200
commit72629a807c71f9b2c282ff5f67994ec3fab78b7f (patch)
tree8c9bd1cfbaf7cf6548ecc200d3d3379911457e5b
parentf38f4c02a2ac8b519305cb0bcdc00cd94eaf9a5a (diff)
Fixed crash in QtSvg caused by division by zero in animation code.
Reviewed-by: Trond
-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 d079f9819..720dbb6f1 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -523,11 +523,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;