From 976d8b1f74d3fe556e4f468936affccbd3124247 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 24 Feb 2021 13:43:01 +0100 Subject: [PATCH] Assert that setCurrentAnimation has the assumed side effect setCurrentAnimation(0) is expected to set the currentAnimation pointer - which it does, as long as there are any animations. Fixes static analyzer warning 106daf11ddfe9bb4fa7cf98c9097962c Pick-to: 6.1 Change-Id: I3739bcfda103db391d21f135485f0b700c48ead1 Reviewed-by: Ulf Hermann --- src/corelib/animation/qsequentialanimationgroup.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 8b364384f4a..1d0b799fefe 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -503,8 +503,10 @@ void QSequentialAnimationGroupPrivate::_q_uncontrolledAnimationFinished() */ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index) { - if (currentAnimation == nullptr) + if (currentAnimation == nullptr) { setCurrentAnimation(0); // initialize the current animation + Q_ASSERT(currentAnimation); + } if (currentAnimationIndex == index && currentAnimation->currentTime() == 0 && currentAnimation->currentLoop() == 0) {