diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-02-18 09:35:21 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-02-18 10:16:20 +0100 |
commit | 8a656c0a4b21fbc9180e98279d4fade78d6dab7e (patch) | |
tree | bf0decfb1549aa48b607c1b7f1e96fde05c78398 /src/qml/qml/qqmltype.cpp | |
parent | 8bc51b89a1d71ca9c6b1595ce497e0d91e9d2634 (diff) |
QQmlType: Do not dereference pointer if null
This can occur when attempting to access invalid attached properties
(e.g. tst_qmllanguage/invalidAttachedProperty.6.qml)
Change-Id: Id562e2b21fccd8d123a5859d7cc547d098c1ab78
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltype.cpp')
-rw-r--r-- | src/qml/qml/qqmltype.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/qml/qqmltype.cpp b/src/qml/qml/qqmltype.cpp index 28fefca239..2b804c45a7 100644 --- a/src/qml/qml/qqmltype.cpp +++ b/src/qml/qml/qqmltype.cpp @@ -636,14 +636,14 @@ int QQmlType::metaObjectRevision() const QQmlAttachedPropertiesFunc QQmlType::attachedPropertiesFunction(QQmlEnginePrivate *engine) const { - if (const QQmlTypePrivate *base = d->attachedPropertiesBase(engine)) + if (const QQmlTypePrivate *base = d ? d->attachedPropertiesBase(engine) : nullptr) return base->extraData.cd->attachedPropertiesFunc; return nullptr; } const QMetaObject *QQmlType::attachedPropertiesType(QQmlEnginePrivate *engine) const { - if (const QQmlTypePrivate *base = d->attachedPropertiesBase(engine)) + if (const QQmlTypePrivate *base = d ? d->attachedPropertiesBase(engine) : nullptr) return base->extraData.cd->attachedPropertiesType; return nullptr; } |