From 364cf0bf20d7acdc0ed4073db0ca603ec5435c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Tue, 8 Jul 2014 14:56:25 +0200 Subject: 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 --- src/corelib/json/qjsonvalue.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib/json') 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(base)) == QJsonArray(other.d, static_cast(other.base)); case Object: -- cgit v1.2.3