QJsonValueConstRef: fix null pointer dereferences

Introduced in commit 705ea62f9e, but
apparently these constructors aren't used anywhere yet.

Change-Id: Ic30914a4448d4bc28974fffd16dc521ab49d3be4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2022-03-14 11:17:18 -07:00
parent 6492a9c877
commit 03de9ff7ee
2 changed files with 2 additions and 2 deletions

View File

@ -271,7 +271,7 @@ Q_DECLARE_SHARED(QJsonArray)
#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED)
inline QJsonValueConstRef::QJsonValueConstRef(QJsonArray *a, qsizetype idx)
: d(a->a.data()), is_object(false), index(idx)
: d(a ? a->a.data() : nullptr), is_object(false), index(idx)
{}
#endif

View File

@ -313,7 +313,7 @@ Q_DECLARE_SHARED(QJsonObject)
#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED)
inline QJsonValueConstRef::QJsonValueConstRef(QJsonObject *o, qsizetype idx)
: d(o->o.data()), is_object(true), index(idx)
: d(o ? o->o.data() : nullptr), is_object(true), index(idx)
{}
#endif