mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-21 23:00:24 -08:00
server crash fix
This commit is contained in:
@@ -331,7 +331,13 @@ ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *st
|
|||||||
|
|
||||||
QList<QPair<Server_Card *, int> > cardsToMove;
|
QList<QPair<Server_Card *, int> > cardsToMove;
|
||||||
QMap<Server_Card *, CardToMove *> cardProperties;
|
QMap<Server_Card *, CardToMove *> cardProperties;
|
||||||
|
QSet<int> cardIdsToMove;
|
||||||
for (int i = 0; i < _cards.size(); ++i) {
|
for (int i = 0; i < _cards.size(); ++i) {
|
||||||
|
// The same card being moved twice would lead to undefined behaviour.
|
||||||
|
if (cardIdsToMove.contains(_cards[i]->getCardId()))
|
||||||
|
continue;
|
||||||
|
cardIdsToMove.insert(_cards[i]->getCardId());
|
||||||
|
|
||||||
int position;
|
int position;
|
||||||
Server_Card *card = startzone->getCard(_cards[i]->getCardId(), &position);
|
Server_Card *card = startzone->getCard(_cards[i]->getCardId(), &position);
|
||||||
if (!card)
|
if (!card)
|
||||||
|
|||||||
Reference in New Issue
Block a user