Skip to content

Commit

Permalink
game: fixed some NPE errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JayDi85 committed Sep 23, 2023
1 parent a078b67 commit b80f440
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class AttachedToMatchesFilterCondition implements Condition {

public AttachedToMatchesFilterCondition(FilterPermanent filter) {
this.filter = filter;
if (filter == null) {
throw new IllegalStateException("Wrong code usage. Filter must be non-nullable.");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public boolean apply(Game game, Ability source) {
if (sourcePermanent == null) {
sourcePermanent = game.getPermanentEntering(source.getSourceId());
}
if (controller != null) {
if (controller != null && sourcePermanent != null) {
Choice choice = new ChoiceImpl(true);
choice.setMessage(choiceMessage);
choice.getChoices().addAll(modes);
Expand Down

0 comments on commit b80f440

Please sign in to comment.