mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Fix NPE
This commit is contained in:
@@ -118,24 +118,22 @@ public class ControlGainEffect extends SpellAbilityEffect {
|
|||||||
final Game game = newController.getGame();
|
final Game game = newController.getGame();
|
||||||
|
|
||||||
CardCollectionView tgtCards = null;
|
CardCollectionView tgtCards = null;
|
||||||
if (sa.hasParam("ControlledByTarget")) {
|
if (sa.hasParam("Choices")) {
|
||||||
tgtCards = CardLists.filterControlledBy(tgtCards, getTargetPlayers(sa));
|
|
||||||
} else if (sa.hasParam("Choices")) {
|
|
||||||
Player chooser = sa.hasParam("Chooser") ? AbilityUtils.getDefinedPlayers(source,
|
Player chooser = sa.hasParam("Chooser") ? AbilityUtils.getDefinedPlayers(source,
|
||||||
sa.getParam("Chooser"), sa).get(0) : activator;
|
sa.getParam("Chooser"), sa).get(0) : activator;
|
||||||
CardCollectionView choices = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield),
|
CardCollectionView choices = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield),
|
||||||
sa.getParam("Choices"), activator, source, sa);
|
sa.getParam("Choices"), activator, source, sa);
|
||||||
if (!choices.isEmpty()) {
|
if (!choices.isEmpty()) {
|
||||||
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") :
|
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") :
|
||||||
Localizer.getInstance().getMessage("lblChooseaCard") +" ";
|
Localizer.getInstance().getMessage("lblChooseaCard") +" ";
|
||||||
tgtCards = activator.getController().chooseCardsForEffect(choices, sa, title, 1, 1, false, null);
|
tgtCards = chooser.getController().chooseCardsForEffect(choices, sa, title, 1, 1, false, null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tgtCards = getDefinedCards(sa);
|
tgtCards = getDefinedCards(sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tgtCards == null) {
|
if (tgtCards !=null & sa.hasParam("ControlledByTarget")) {
|
||||||
return;
|
tgtCards = CardLists.filterControlledBy(tgtCards, getTargetPlayers(sa));
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case source was LKI or still resolving
|
// in case source was LKI or still resolving
|
||||||
|
|||||||
Reference in New Issue
Block a user