summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-22 08:45:25 +0200
committerLinus Groh <mail@linusgroh.de>2021-05-22 12:03:31 +0100
commit0dd22c4e23c6b3861c43605d804a9adfc67d1188 (patch)
tree6e6b0254c77160c81b61170a42c65c53dc48f548 /Userland
parent630430379ef91d61852c4c4db1bf6a8c0edf45d3 (diff)
downloadserenity-0dd22c4e23c6b3861c43605d804a9adfc67d1188.zip
Hearts: Fix crash when starting an animation when there already is one
This ensures that the preceding animation is stopped first.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Games/Hearts/Game.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp
index 5298bbb3cf..fde3e02775 100644
--- a/Userland/Games/Hearts/Game.cpp
+++ b/Userland/Games/Hearts/Game.cpp
@@ -121,6 +121,8 @@ void Game::setup()
void Game::start_animation(NonnullRefPtrVector<Card> cards, Gfx::IntPoint const& end, Function<void()> did_finish_callback, int initial_delay_ms, int steps)
{
+ stop_animation();
+
m_animation_end = end;
m_animation_current_step = 0;
m_animation_steps = steps;