QDial: Fix crash when singleStep-property is 0.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Fri, 9 Dec 2011 08:02:48 +0000 (09:02 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 16 Feb 2012 03:23:20 +0000 (04:23 +0100)
Task-number: QTBUG-23072

Change-Id: I296b46af23420b24fa5460b9660e33bf203ea29f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com>
(cherry picked from commit 6d370a19e367d0ccec59db5c34cbe2e3f7cfc586)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
src/widgets/styles/qstylehelper.cpp

index 818671f..3fdbc98 100644 (file)
@@ -159,7 +159,9 @@ QPolygonF calcLines(const QStyleOptionSlider *dial)
 
     qreal xc = width / 2 + 0.5;
     qreal yc = height / 2 + 0.5;
-    int ns = dial->tickInterval;
+    const int ns = dial->tickInterval;
+    if (!ns) // Invalid values may be set by Qt Designer.
+        return poly;
     int notches = (dial->maximum + ns - 1 - dial->minimum) / ns;
     if (notches <= 0)
         return poly;