mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00: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<>();
|
||||
for (UUID cardId : this) {
|
||||
Card card = game.getCard(cardId);
|
||||
cards.add(card.getName());
|
||||
if (card != null) {
|
||||
cards.add(card.getName());
|
||||
}
|
||||
}
|
||||
Collections.sort(cards);
|
||||
for (String name : cards) {
|
||||
|
@ -183,7 +185,9 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
Map<String, Card> cards = new HashMap<>();
|
||||
for (UUID cardId : this) {
|
||||
Card card = game.getCard(cardId);
|
||||
cards.putIfAbsent(card.getName(), card);
|
||||
if (card != null) {
|
||||
cards.putIfAbsent(card.getName(), card);
|
||||
}
|
||||
}
|
||||
return cards.values();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue