diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2020-08-10 10:25:41 -0700 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-08-12 03:20:34 +0000 |
commit | 801f719f12da68508a21ecebf1b37db6650beb8a (patch) | |
tree | b27a0db43a3ef9a5540ce17d05cbac7dbebf7672 /src/corelib/serialization | |
parent | f0186293dffc5a67d6700f73a990949c60a222c6 (diff) |
QJsonDocument: fix comparison of valid vs default
[ChangeLog][QtCore][QJsonDocument] Fixed a bug that caused
QJsonDocument's equality operator to crash if one of the operands was
default-constructed and the other wasn't.
Fixes: QTBUG-85969
Change-Id: I5e00996d7f4b4a10bc98fffd1629f835f570ef6b
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit e790af0e0a030dea597bbc9489170b5ba1cf9e46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/serialization')
-rw-r--r-- | src/corelib/serialization/qjsondocument.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/serialization/qjsondocument.cpp b/src/corelib/serialization/qjsondocument.cpp index 338b752f13..1d48dcaf24 100644 --- a/src/corelib/serialization/qjsondocument.cpp +++ b/src/corelib/serialization/qjsondocument.cpp @@ -690,7 +690,9 @@ const QJsonValue QJsonDocument::operator[](int i) const */ bool QJsonDocument::operator==(const QJsonDocument &other) const { - return (!d) ? (!other.d) : (d->value == other.d->value); + if (d && other.d) + return d->value == other.d->value; + return !d == !other.d; } /*! |