diff --git a/cockatrice/src/game/board/card_item.cpp b/cockatrice/src/game/board/card_item.cpp index afcd38789..382803b96 100644 --- a/cockatrice/src/game/board/card_item.cpp +++ b/cockatrice/src/game/board/card_item.cpp @@ -54,9 +54,9 @@ void CardItem::prepareDelete() void CardItem::deleteLater() { - prepareDelete(); if (scene()) static_cast(scene())->unregisterAnimationItem(this); + prepareDelete(); AbstractCardItem::deleteLater(); } diff --git a/cockatrice/src/game/game_scene.cpp b/cockatrice/src/game/game_scene.cpp index 1494661d7..df2b67664 100644 --- a/cockatrice/src/game/game_scene.cpp +++ b/cockatrice/src/game/game_scene.cpp @@ -304,8 +304,11 @@ void GameScene::timerEvent(QTimerEvent * /*event*/) QMutableSetIterator i(cardsToAnimate); while (i.hasNext()) { i.next(); - if (!i.value()->animationEvent()) + if (i.value() == nullptr) { i.remove(); + } else if (!i.value()->animationEvent()) { + i.remove(); + } } if (cardsToAnimate.isEmpty()) animationTimer->stop();