diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2021-07-26 20:13:09 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2021-07-27 18:16:13 +0200 |
commit | 3b8127c3fcf07905180e274c7e554aaa757963c3 (patch) | |
tree | b74e8eba25d3519ff2dcfe50f6263ff8c06826d6 | |
parent | 62b33b6730ab995022149e65618a4a92b4992a49 (diff) |
doubleToString: Fix assert when double is NaN
wholePartSpace asserts that its input is >= 0, but NaN is not a number
Change-Id: Iafc075663d5f8841f21edf0a3d4d36694287a51f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r-- | src/corelib/text/qlocale.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index c7cecce37f..d5cde8a69d 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -3384,7 +3384,7 @@ QString QLocaleData::doubleToString(double d, int precision, DoubleForm form, int bufSize = 1; if (precision == QLocale::FloatingPointShortest) bufSize += std::numeric_limits<double>::max_digits10; - else if (form == DFDecimal) + else if (form == DFDecimal && qIsFinite(d)) bufSize += wholePartSpace(qAbs(d)) + precision; else // Add extra digit due to different interpretations of precision. Also, "nan" has to fit. bufSize += qMax(2, precision) + 1; |