forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user