Commit f0c028d1 authored by Boudewijn Rempt's avatar Boudewijn Rempt

CID 34798: Division or modulo by float zero (DIVIDE_BY_ZERO)

12. divide_by_zero: In expression dist /= count, division by expression
count which may be zero has undefined behavior.
parent 14ee7638
......@@ -208,10 +208,12 @@ void KisZoomAction::inputEvent( QEvent* event )
Q_FOREACH (const QTouchEvent::TouchPoint &point, tevent->touchPoints()) {
if (point.state() != Qt::TouchPointReleased) {
count++;
dist += (point.pos() - center).manhattanLength();
}
}
if (count == 0) {
count = 1;
}
dist /= count;
float delta = qFuzzyCompare(1.0f, 1.0f + d->lastDistance) ? 1.f : dist / d->lastDistance;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment