diff options
Diffstat (limited to 'src/corelib/json/qjsonvalue.cpp')
-rw-r--r-- | src/corelib/json/qjsonvalue.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index 4c4838d314..6e40308de3 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -606,15 +606,19 @@ 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: 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)); } @@ -669,11 +673,10 @@ void QJsonValue::detach() However, they are not explicitly documented here. */ - QJsonValueRef &QJsonValueRef::operator =(const QJsonValue &val) { if (is_object) - o->setValueAt(index, val); + UnionHelper::setValueAt(this, val); else a->replace(index, val); @@ -683,7 +686,7 @@ QJsonValueRef &QJsonValueRef::operator =(const QJsonValue &val) QJsonValueRef &QJsonValueRef::operator =(const QJsonValueRef &ref) { if (is_object) - o->setValueAt(index, ref); + UnionHelper::setValueAt(this, ref); else a->replace(index, ref); @@ -704,7 +707,7 @@ QJsonValue QJsonValueRef::toValue() const { if (!is_object) return a->at(index); - return o->valueAt(index); + return UnionHelper::valueAt(this); } #if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY) |