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:30:02 +0200 |
commit | b65935469440dbe869de163e2cd8426ec9e1b461 (patch) | |
tree | fffeb7e71e053a94747cc3f2aecdc3594a89a4fa | |
parent | b33cbd3b7cd3eafef1d97f4b6deb0364e4a45af4 (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 2883cb3031..3edcbe7c24 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -628,8 +628,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()) { |