summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@digia.com>2013-05-15 10:34:47 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-15 12:23:38 (GMT)
commitf8fdc82e88dd4546062ee220712c300a654472b9 (patch)
treeb3d3206ceb9654c2ad289a532fb3452922cbd38c /src/gui
parent81ce34e3120102f57ae7fd5ec9d4bf4d09dfb77b (diff)
downloadQt-f8fdc82e88dd4546062ee220712c300a654472b9.zip
Qt-f8fdc82e88dd4546062ee220712c300a654472b9.tar.gz
Qt-f8fdc82e88dd4546062ee220712c300a654472b9.tar.bz2
Widgets: avoid integer divide by zero in QProgressDialog
Autotest is included. Task-number: QTBUG-31046 Change-Id: Ief7d71b58e7a5416f3659f19445e5d729849b3b6 (cherry picked from commit 69c05bbef47fb9d30d70e594bd5942add8b135fe) Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qprogressdialog.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp
index 43bce7d..9bab29a 100644
--- a/src/gui/dialogs/qprogressdialog.cpp
+++ b/src/gui/dialogs/qprogressdialog.cpp
@@ -693,6 +693,7 @@ void QProgressDialog::setValue(int progress)
int estimate;
int totalSteps = maximum() - minimum();
int myprogress = progress - minimum();
+ if (myprogress == 0) myprogress = 1;
if ((totalSteps - myprogress) >= INT_MAX / elapsed)
estimate = (totalSteps - myprogress) / myprogress * elapsed;
else