diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2015-09-23 12:43:41 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2015-09-24 07:40:39 +0000 |
commit | 7a8da57a637f7a0b94199bb0e19f97a53958a8f0 (patch) | |
tree | 6ac9e7cba4759cb3d61d3a38a42b880e20f4131f /src | |
parent | 1ddd33ae662d3fe14e4bd581815a7c3aa42d832e (diff) |
Be more forgiving about arguments to QString::arg(double).
The arguments for the width and precision parameters, that is. There's
no reason to crash if a user sets e.g. a precision of -2.
Task-number: QTBUG-46838
Change-Id: I4afc004a1b8aa1306fd996360b16117b2b643640
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 703341cc36..181daa04e4 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2742,9 +2742,9 @@ QString QLocaleData::doubleToString(const QChar _zero, const QChar plus, const Q const QChar exponential, const QChar group, const QChar decimal, double d, int precision, DoubleForm form, int width, unsigned flags) { - if (precision == -1) + if (precision < 0) precision = 6; - if (width == -1) + if (width < 0) width = 0; bool negative = false; |