Fixed NPE errors for some cards

This commit is contained in:
Oleg Agafonov 2018-12-23 17:56:46 +04:00
parent 2e3fabb161
commit e75e2324c7

View file

@ -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();
}