forked from External/mage
add better null checking around Mirror Golem exileId code
This commit is contained in:
parent
ae0e0c873b
commit
d462d1fcc8
1 changed files with 9 additions and 5 deletions
|
|
@ -76,11 +76,13 @@ class MirrorGolemImprintEffect extends OneShotEffect {
|
|||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
|
||||
if (card != null) {
|
||||
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), sourcePermanent.getZoneChangeCounter(game));
|
||||
String exileZoneName = source.getSourceObject(game).getIdName();
|
||||
controller.moveCardsToExile(card, source, game, true, exileZoneId, exileZoneName);
|
||||
if (sourcePermanent != null) {
|
||||
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), sourcePermanent.getZoneChangeCounter(game));
|
||||
String exileZoneName = sourcePermanent.getIdName();
|
||||
controller.moveCardsToExile(card, source, game, true, exileZoneId, exileZoneName);
|
||||
sourcePermanent.imprint(this.getTargetPointer().getFirst(game, source), game);
|
||||
} else {
|
||||
controller.moveCardsToExile(card, source, game, true, null, "");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -104,10 +106,12 @@ class MirrorGolemEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
||||
if (sourceObject == null || sourceObject.getImprinted() == null) {
|
||||
return false;
|
||||
}
|
||||
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), sourceObject.getZoneChangeCounter(game));
|
||||
ExileZone exileZone = game.getExile().getExileZone(exileZoneId);
|
||||
|
||||
if (sourceObject == null || sourceObject.getImprinted() == null || exileZone == null) {
|
||||
if (exileZone == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue