mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 01:24:46 -07:00
Add a guard in case the printing info is empty for a related card. (#6087)
Took 4 hours 19 minutes Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
268559d8de
commit
ba794c2b60
2 changed files with 24 additions and 4 deletions
|
|
@ -460,8 +460,21 @@ bool CardDatabase::isPreferredPrinting(const CardRef &cardRef) const
|
|||
|
||||
ExactCard CardDatabase::getCardFromSameSet(const QString &cardName, const PrintingInfo &otherPrinting) const
|
||||
{
|
||||
// The source card does not have a printing defined, which means we can't get a card from the same set.
|
||||
if (otherPrinting == PrintingInfo()) {
|
||||
return getCard({cardName});
|
||||
}
|
||||
|
||||
// The source card does have a printing defined, which means we can attempt to get a card from the same set.
|
||||
PrintingInfo relatedPrinting = getSpecificPrinting(cardName, otherPrinting.getSet()->getCorrectedShortName(), "");
|
||||
return ExactCard(guessCard({cardName}).getCardPtr(), relatedPrinting);
|
||||
ExactCard relatedCard = ExactCard(guessCard({cardName}).getCardPtr(), relatedPrinting);
|
||||
|
||||
// We didn't find a card from the same set, just try to find any card with the same name.
|
||||
if (!relatedCard) {
|
||||
return getCard({cardName});
|
||||
}
|
||||
|
||||
return relatedCard;
|
||||
}
|
||||
|
||||
void CardDatabase::refreshCachedReverseRelatedCards()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue