mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
Fixed NPE errors for some cards
This commit is contained in:
parent
2e3fabb161
commit
e75e2324c7
1 changed files with 6 additions and 2 deletions
|
|
@ -155,7 +155,9 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
||||||
List<String> cards = new ArrayList<>();
|
List<String> cards = new ArrayList<>();
|
||||||
for (UUID cardId : this) {
|
for (UUID cardId : this) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
cards.add(card.getName());
|
if (card != null) {
|
||||||
|
cards.add(card.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(cards);
|
Collections.sort(cards);
|
||||||
for (String name : cards) {
|
for (String name : cards) {
|
||||||
|
|
@ -183,7 +185,9 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
||||||
Map<String, Card> cards = new HashMap<>();
|
Map<String, Card> cards = new HashMap<>();
|
||||||
for (UUID cardId : this) {
|
for (UUID cardId : this) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
cards.putIfAbsent(card.getName(), card);
|
if (card != null) {
|
||||||
|
cards.putIfAbsent(card.getName(), card);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return cards.values();
|
return cards.values();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue