fix nullptr bug

This commit is contained in:
RickyRister 2024-12-15 05:17:10 -08:00
parent b81cba1784
commit d81fa57adf

View file

@ -3026,12 +3026,23 @@ void Player::cardMenuAction()
} }
} }
} else { } else {
CardZone *zone = cardList[0]->getZone();
if (!zone) {
return;
}
Player *startPlayer = zone->getPlayer();
if (!startPlayer) {
return;
}
int startPlayerId = startPlayer->getId();
QString startZone = zone->getName();
ListOfCardsToMove idList; ListOfCardsToMove idList;
for (const auto &i : cardList) { for (const auto &i : cardList) {
idList.add_card()->set_card_id(i->getId()); idList.add_card()->set_card_id(i->getId());
} }
int startPlayerId = cardList[0]->getZone()->getPlayer()->getId();
QString startZone = cardList[0]->getZone()->getName();
switch (static_cast<CardMenuActionType>(a->data().toInt())) { switch (static_cast<CardMenuActionType>(a->data().toInt())) {
case cmMoveToTopLibrary: { case cmMoveToTopLibrary: {