Fix regression from #4281 which caused crash if card was null (#4340)

This commit is contained in:
Zach H 2021-05-09 13:10:13 -04:00 committed by GitHub
parent ff6f28390a
commit b9c4b496e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -578,6 +578,10 @@ void Server_Game::unattachCards(GameEventStorage &ges, Server_Player *player)
QMapIterator<QString, Server_CardZone *> zoneIterator(player->getZones()); QMapIterator<QString, Server_CardZone *> zoneIterator(player->getZones());
for (Server_CardZone *zone : player->getZones()) { for (Server_CardZone *zone : player->getZones()) {
for (Server_Card *card : zone->getCards()) { for (Server_Card *card : zone->getCards()) {
if (card == nullptr) {
continue;
}
// Make a copy of the list because the original one gets modified during the loop // Make a copy of the list because the original one gets modified during the loop
QList<Server_Card *> attachedCards = card->getAttachedCards(); QList<Server_Card *> attachedCards = card->getAttachedCards();
for (Server_Card *attachedCard : attachedCards) { for (Server_Card *attachedCard : attachedCards) {