diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2020-08-10 10:25:41 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2020-08-11 13:00:47 -0700 |
commit | e790af0e0a030dea597bbc9489170b5ba1cf9e46 (patch) | |
tree | 9fe05e1dc2ce938b66492e7f52860e5a668d6cff /src/corelib/serialization | |
parent | d5ef011b73385adfb04b6f5c1f81ee23b9933fd0 (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.
Pick-to: 5.15
Fixes: QTBUG-85969
Change-Id: I5e00996d7f4b4a10bc98fffd1629f835f570ef6b
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
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 579bb70a2b..6ec169da62 100644 --- a/src/corelib/serialization/qjsondocument.cpp +++ b/src/corelib/serialization/qjsondocument.cpp @@ -495,7 +495,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; } /*! |