aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlproperty.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r--src/qml/qml/qqmlproperty.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 8ffdf1738c..68127f8686 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1417,10 +1417,14 @@ bool QQmlPropertyPrivate::write(
if (!ok && QQmlMetaType::isInterface(propertyType)) {
auto valueAsQObject = qvariant_cast<QObject *>(value);
- if (valueAsQObject && valueAsQObject->qt_metacast(QQmlMetaType::interfaceIId(propertyType))) {
+
+ if (void *interface = valueAsQObject
+ ? valueAsQObject->qt_metacast(QQmlMetaType::interfaceIId(propertyType))
+ : nullptr;
+ interface) {
// this case can occur when object has an interface type
// and the variant contains a type implementing the interface
- return property.writeProperty(object, const_cast<void *>(value.constData()), flags);
+ return property.writeProperty(object, &interface, flags);
}
}