From 7a8da57a637f7a0b94199bb0e19f97a53958a8f0 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 23 Sep 2015 12:43:41 +0200 Subject: 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 --- src/corelib/tools/qlocale.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools') 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; -- cgit v1.2.3