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 <ulf.hermann@qt.io>
This commit is contained in:
Volker Hilsheimer 2021-02-24 13:43:01 +01:00
parent e38b55c47c
commit 976d8b1f74

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