diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2019-02-14 17:52:28 +0100 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2019-02-15 06:50:14 +0000 |
commit | 0f6e5a56cb29a2c774823266ce45e2e250dcf247 (patch) | |
tree | 2a714bd47129d539188774048afd494c2ae91a96 /share | |
parent | 25487daffd54bb73e59fc4aa1414beac5b7ed93b (diff) | |
download | qt-creator-0f6e5a56cb29a2c774823266ce45e2e250dcf247.tar.gz |
QmlDesigner: Avoid puppet crash
If the property is invalid the propertyTypeName is a nullptr.
Calling strcmp on nullptr is undefined and can result in a nullptr access.
Change-Id: I270091fa1d2635019ad2e41c4a5eab9985227dcf
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index 3720bdc90a..5247f1f383 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -267,13 +267,13 @@ static bool isList(const QQmlProperty &property) static bool isQJSValue(const QQmlProperty &property) { - return !strcmp(property.propertyTypeName(), "QJSValue"); + return property.isValid() && !strcmp(property.propertyTypeName(), "QJSValue"); } static bool isObject(const QQmlProperty &property) { /* QVariant and QJSValue can also store QObjects. Lets trust our model. */ - return (property.propertyTypeCategory() == QQmlProperty::Object + return property.isValid() && (property.propertyTypeCategory() == QQmlProperty::Object || !strcmp(property.propertyTypeName(), "QVariant") || isQJSValue(property)); } |