diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-02-24 13:43:01 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-02-25 01:33:11 +0000 |
commit | d47e2a28b9216f2af5fc1093c0adfd680a35be9b (patch) | |
tree | ea50b03addbfe94a39d72bf26091874dc0daf8b7 /src/corelib | |
parent | b3182755bd208730ab23bc6250bbc090aafbb8e1 (diff) |
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>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/animation/qsequentialanimationgroup.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 8b364384f4..1d0b799fef 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) { |