diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2021-08-31 11:29:00 +0200 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2021-09-01 17:11:43 +0200 |
commit | 313de93b1d2f415a845521b64e58d81a6e9d7a13 (patch) | |
tree | 601de6043c79815879670ef4c219ae6efe8f93c9 /src/gui/util/qvalidator.cpp | |
parent | 81a9335c653661f70d8bfa8f37d2d72bdef60d41 (diff) |
QDoubleValidator: fix NaN check in validateWithLocale
We can't really compare two NaN's. Should use qIsNaN() for that.
Pick-to: 6.2
Change-Id: Ia514cabe65cfcdeafb39cab91ecdb66f8fae725c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/gui/util/qvalidator.cpp')
-rw-r--r-- | src/gui/util/qvalidator.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index 95d8b2a542..6f93738340 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -683,8 +683,7 @@ QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QL bool ok = false; double i = locale.toDouble(input, &ok); // returns 0.0 if !ok - if (i == qt_qnan()) - return QValidator::Invalid; + Q_ASSERT(!qIsNaN(i)); // Would be caught by validateChars() if (!ok) return QValidator::Intermediate; |