From 77d7348be27016a439f06bef207362d0f91531ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Thu, 26 Jun 2014 13:14:25 +0200 Subject: 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 --- src/corelib/json/qjsonvalue.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib') 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(base)) == QJsonObject(other.d, static_cast(other.base)); } -- cgit v1.2.3