Skip to content

Commit

Permalink
Assert that setCurrentAnimation has the assumed side effect
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vohi committed Feb 24, 2021
1 parent e38b55c commit 976d8b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/corelib/animation/qsequentialanimationgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 976d8b1

Please sign in to comment.