mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Fixed NPE errors on missing card (game.getCard can't find card);
This commit is contained in:
parent
c30316512b
commit
745bfa2836
9 changed files with 25 additions and 13 deletions
|
|
@ -129,7 +129,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
|
||||
@Override
|
||||
public Set<Card> getCards(FilterCard filter, Game game) {
|
||||
return stream().map(game::getCard).filter(card -> filter.match(card, game)).collect(Collectors.toSet());
|
||||
return stream().map(game::getCard).filter(Objects::nonNull).filter(card -> filter.match(card, game)).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ public class Library implements Serializable {
|
|||
* @return
|
||||
*/
|
||||
public List<Card> getCards(Game game) {
|
||||
return library.stream().map(game::getCard).collect(Collectors.toList());
|
||||
return library.stream().map(game::getCard).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Set<Card> getTopCards(Game game, int amount) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue