summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2015-09-23 12:43:41 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2015-09-24 07:40:39 +0000
commit7a8da57a637f7a0b94199bb0e19f97a53958a8f0 (patch)
tree6ac9e7cba4759cb3d61d3a38a42b880e20f4131f /src
parent1ddd33ae662d3fe14e4bd581815a7c3aa42d832e (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.cpp4
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;