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>
bb10
Christian Kandeler 2015-09-23 12:43:41 +02:00
parent 1ddd33ae66
commit 7a8da57a63
1 changed files with 2 additions and 2 deletions

View File

@ -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;