From f8fdc82e88dd4546062ee220712c300a654472b9 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 15 May 2013 12:34:47 +0200 Subject: 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 Reviewed-by: Liang Qi --- src/gui/dialogs/qprogressdialog.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index 43bce7d7b6..9bab29a2d5 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 -- cgit v1.2.3