This commit is contained in:
Jeff Wadsworth 2021-11-15 15:40:44 -06:00
parent e989c05247
commit a6ca9a095c

View file

@ -2,6 +2,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageObject;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -91,9 +92,10 @@ class GiveControlEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
if (permanent != null) {
return permanent.changeControllerId(source.getFirstTarget(), game, source);
MageObject mageObject = source.getSourceObjectIfItStillExists(game);
if (mageObject != null
&& mageObject instanceof Permanent) {
return ((Permanent) mageObject).changeControllerId(source.getFirstTarget(), game, source);
} else {
discard();
}