path: root/src/corelib/json
diff options
authorJędrzej Nowacki <>2014-07-08 14:56:25 +0200
committerJędrzej Nowacki <>2014-07-25 15:25:43 +0200
commit364cf0bf20d7acdc0ed4073db0ca603ec5435c97 (patch)
tree080a2d8c69aad9197692d70772ad06b4e4b701b3 /src/corelib/json
parent77d7348be27016a439f06bef207362d0f91531ca (diff)
Fix QJsonValue comparison.
QJsonValue, while comparing two QJsonArrays, should consult also length of the arrays, because a different than null base pointer doesn't mean that an array is not empty. Change-Id: If76739355a4e74b842e836289565f98d95c006d5 Reviewed-by: Lars Knoll <>
Diffstat (limited to 'src/corelib/json')
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp
index deca70c3ea..6e40308de3 100644
--- a/src/corelib/json/qjsonvalue.cpp
+++ b/src/corelib/json/qjsonvalue.cpp
@@ -606,8 +606,10 @@ bool QJsonValue::operator==(const QJsonValue &other) const
case Array:
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 QJsonArray(d, static_cast<QJsonPrivate::Array *>(base))
== QJsonArray(other.d, static_cast<QJsonPrivate::Array *>(other.base));
case Object: