[AFR] Fixed NPE on Rogue class if no cards were exiled when it is leveled up to level 3. Closes #9422.

This commit is contained in:
Alex Vasile 2022-08-27 15:22:02 -04:00
parent 90bd0dbf63
commit f5eb036158

View file

@ -16,6 +16,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.ExileZone;
import mage.game.Game; import mage.game.Game;
import mage.players.ManaPoolItem; import mage.players.ManaPoolItem;
import mage.players.Player; import mage.players.Player;
@ -183,9 +184,12 @@ class RogueClassPlayEffect extends AsThoughEffectImpl {
objectId = theCard.getMainCard().getId(); // for split cards objectId = theCard.getMainCard().getId(); // for split cards
UUID exileZoneId = CardUtil.getExileZoneId(game, sourceObject.getId(), sourceObject.getZoneChangeCounter(game)); UUID exileZoneId = CardUtil.getExileZoneId(game, sourceObject.getId(), sourceObject.getZoneChangeCounter(game));
ExileZone exileZone = game.getExile().getExileZone(exileZoneId);
if (exileZone == null) {
return false;
}
// this check happens while the chosen card is in the exile zone // this check happens while the chosen card is in the exile zone
if (game.getExile().getExileZone(exileZoneId).contains(objectId) if (exileZone.contains(objectId) && affectedControllerId.equals(source.getControllerId())) {
&& affectedControllerId.equals(source.getControllerId())) {
Card card = game.getCard(objectId); Card card = game.getCard(objectId);
return card != null; return card != null;
} }