game: fixed some NPE errors

This commit is contained in:
Oleg Agafonov 2023-09-23 07:41:18 +04:00
parent a078b67434
commit b80f440e15
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -47,7 +47,7 @@ public class ChooseModeEffect extends OneShotEffect {
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);