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

Change-Id: I3739bcfda103db391d21f135485f0b700c48ead1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 976d8b1f74d3fe556e4f468936affccbd3124247)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2021-02-24 13:43:01 +01:00 committed by Qt Cherry-pick Bot
parent b3182755bd
commit d47e2a28b9

View File

@ -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) {