summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qvariant.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index f28cd5a7a0f..31c21730725 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -2032,10 +2032,10 @@ bool QVariant::convert(QMetaType targetType)
QVariant oldValue = *this;
clear();
+ create(targetType.id(), nullptr);
if (!oldValue.canConvert(targetType))
return false;
- create(targetType.id(), nullptr);
// Fail if the value is not initialized or was forced null by a previous failed convert.
if (oldValue.d.is_null && oldValue.d.typeId() != QMetaType::Nullptr)
return false;