diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-04-09 10:15:36 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-04-14 14:31:37 +0200 |
commit | 8ef947deab6c9345ddac2d96dc60f2490974c1df (patch) | |
tree | 153c531e6db657a8dab0e0f1a1eee251bb761c16 | |
parent | 57ee54fb4770b618b0bbd06b069682b5cd11fc9f (diff) |
Don't crash when trying to invoke non-existing string converter
String converters are removed in 6.2 anyway.
Fixes: QTBUG-89892
Change-Id: I504c00d99580e3d27d04f420295dd97251657ef4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d250e0070701e9c511ef5b1fb0d23995872ad844)
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 4920f83365..c1b60d13b0 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -679,8 +679,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()); - Q_ASSERT(converter); - QVariant value = (*converter)(stringValue); + QVariant value = converter ? (*converter)(stringValue) : QVariant(); QMetaProperty metaProperty = _qobject->metaObject()->property(property->coreIndex()); if (value.isNull() || metaProperty.userType() != property->propType()) { |