summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-06-26 13:14:25 +0200
committerJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-07-25 15:25:29 +0200
commit77d7348be27016a439f06bef207362d0f91531ca (patch)
tree8382e3266d22acb659a2ef6b89de51142ddff127 /src
parent20cf632ad5f3ffe7b0fd231724c971f4e07304eb (diff)
Fix QJsonValue comparison.
QJsonValue, while comparing two QJsonObjects, should consult also length of the objects, because a different than null base pointer doesn't mean that an object is not empty. Change-Id: Ibee1849ef9fed15d32f2c8f2aad9b053846e46b7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/json/qjsonvalue.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp
index 1224a24709..deca70c3ea 100644
--- a/src/corelib/json/qjsonvalue.cpp
+++ b/src/corelib/json/qjsonvalue.cpp
@@ -613,8 +613,10 @@ bool QJsonValue::operator==(const QJsonValue &other) const
case Object:
if (base == other.base)
return true;
- if (!base || !other.base)
- return false;
+ if (!base)
+ return !other.base->length;
+ if (!other.base)
+ return !base->length;
return QJsonObject(d, static_cast<QJsonPrivate::Object *>(base))
== QJsonObject(other.d, static_cast<QJsonPrivate::Object *>(other.base));
}