QmlDesigner: Fix puppet crash when property animation has no target

Fixes: QDS-6935
Change-Id: Ib6dae3a6c39a12e9e62bd494d5a27917d7f97048
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2022-05-12 17:10:09 +03:00
parent e703ee97d6
commit 0334d4886b
2 changed files with 2 additions and 2 deletions

View File

@@ -1610,7 +1610,7 @@ void NodeInstanceServer::addAnimation(QQuickAbstractAnimation *animation)
m_animations.push_back(animation); m_animations.push_back(animation);
QQuickPropertyAnimation *panim = qobject_cast<QQuickPropertyAnimation *>(animation); QQuickPropertyAnimation *panim = qobject_cast<QQuickPropertyAnimation *>(animation);
if (panim) { if (panim && panim->target()) {
QObject *target = panim->target(); QObject *target = panim->target();
QString property = panim->property(); QString property = panim->property();
QVariant value = target->property(qPrintable(baseProperty(property))); QVariant value = target->property(qPrintable(baseProperty(property)));

View File

@@ -534,7 +534,7 @@ void Qt5InformationNodeInstanceServer::handleParticleSystemDeselected()
for (auto a : anim) { for (auto a : anim) {
a->stop(); a->stop();
QQuickPropertyAnimation *panim = qobject_cast<QQuickPropertyAnimation *>(a); QQuickPropertyAnimation *panim = qobject_cast<QQuickPropertyAnimation *>(a);
if (panim) if (panim && panim->target())
panim->target()->setProperty(qPrintable(baseProperty(panim->property())), animationDefaultValue(i)); panim->target()->setProperty(qPrintable(baseProperty(panim->property())), animationDefaultValue(i));
i++; i++;
} }