summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-04-09 10:15:36 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-04-09 11:05:00 +0200
commitd250e0070701e9c511ef5b1fb0d23995872ad844 (patch)
tree215a531147d561e1df677f84d33e368fba6a0520
parent81c2da0c7ccc361e3cc2206d30aaeb55065a5352 (diff)
Don't crash when trying to invoke non-existing string converter
String converters are removed in 6.2 anyway. Fixes: QTBUG-89892 Pick-to: 5.15 6.0 Change-Id: I504c00d99580e3d27d04f420295dd97251657ef4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 47d1b5e785..2d2ff85621 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -631,8 +631,7 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const
// otherwise, try a custom type assignment
QString stringValue = compilationUnit->bindingValueAsString(binding);
QQmlMetaType::StringConverter converter = QQmlMetaType::customStringConverter(property->propType().id());
- Q_ASSERT(converter);
- QVariant value = (*converter)(stringValue);
+ QVariant value = converter ? (*converter)(stringValue) : QVariant();
QMetaProperty metaProperty = _qobject->metaObject()->property(property->coreIndex());
if (value.isNull() || metaProperty.metaType() != property->propType()) {