summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativepathview.cpp
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-04-30 03:53:20 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-04-30 04:11:12 (GMT)
commit14b067f85f92194f2c444259e2a70fb095dfb73f (patch)
tree28004b6f7dba885531a60eb501b98fd1df59d50d /src/declarative/graphicsitems/qdeclarativepathview.cpp
parent94853c6310bb0f9f3ca08e3c1fa0976ec3d8d285 (diff)
downloadQt-14b067f85f92194f2c444259e2a70fb095dfb73f.zip
Qt-14b067f85f92194f2c444259e2a70fb095dfb73f.tar.gz
Qt-14b067f85f92194f2c444259e2a70fb095dfb73f.tar.bz2
Fix assert in qdeclarativepathview
Task-number: QTBUG-10327 Reviewed-by: Martin Jones
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativepathview.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 911f5a4..2f963cd 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -966,7 +966,12 @@ void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
else
dist = qRound(dist - d->offset) + d->offset;
// Calculate accel required to stop on item boundary
- accel = v2 / (2.0f * qAbs(dist));
+ if (dist <= 0.) {
+ dist = 0.;
+ accel = 0.;
+ } else {
+ accel = v2 / (2.0f * qAbs(dist));
+ }
}
d->moveOffset.setValue(d->offset);
d->tl.accel(d->moveOffset, velocity, accel, dist);