mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-12 07:40:30 -08:00
Fix segfault when creating token of opponent's card (#6144)
* Fix segfault when creating token of opponent's card * clean up code
This commit is contained in:
@@ -878,7 +878,12 @@ void PlayerActions::actCreateAnotherToken()
|
||||
|
||||
void PlayerActions::setLastToken(CardInfoPtr cardInfo)
|
||||
{
|
||||
if (cardInfo == nullptr || !player->getPlayerMenu()->getUtilityMenu()->createAnotherTokenActionExists()) {
|
||||
if (cardInfo == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
UtilityMenu *utilityMenu = player->getPlayerMenu()->getUtilityMenu();
|
||||
if (utilityMenu == nullptr || !utilityMenu->createAnotherTokenActionExists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -892,8 +897,7 @@ void PlayerActions::setLastToken(CardInfoPtr cardInfo)
|
||||
|
||||
lastTokenTableRow = TableZone::clampValidTableRow(2 - cardInfo->getTableRow());
|
||||
|
||||
player->getPlayerMenu()->getUtilityMenu()->setAndEnableCreateAnotherTokenAction(
|
||||
tr("C&reate another %1 token").arg(lastTokenInfo.name));
|
||||
utilityMenu->setAndEnableCreateAnotherTokenAction(tr("C&reate another %1 token").arg(lastTokenInfo.name));
|
||||
}
|
||||
|
||||
void PlayerActions::actCreatePredefinedToken()
|
||||
|
||||
Reference in New Issue
Block a user