Fixed some possible null pointer exceptions (found in server log). Market Festival, Kindred Summons, Profane Processions, New Blood, Kindred Charge , Bishop of Binding, Metzal Tower of Triumph, Chrome Mox

This commit is contained in:
LevelX2 2018-01-11 06:12:27 +01:00
parent a38ec84581
commit 2685d9f8b4
10 changed files with 62 additions and 38 deletions

View file

@ -60,12 +60,15 @@ import mage.target.TargetCard;
import mage.util.CardUtil;
import mage.util.GameLog;
import mage.util.ThreadLocalStringBuilder;
import org.apache.log4j.Logger;
/**
* @author BetaSteward_at_googlemail.com
*/
public abstract class PermanentImpl extends CardImpl implements Permanent {
private static final Logger logger = Logger.getLogger(PermanentImpl.class);
public class MarkedDamageInfo {
public MarkedDamageInfo(Counter counter, MageObject sourceObject) {
@ -699,6 +702,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
}
}
}
if (getSpellAbility() == null) {
logger.info("FATAL : no spell ability for attach to permanent: " + getName());
return;
}
if (!getSpellAbility().getTargets().isEmpty() && (getSpellAbility().getTargets().get(0) instanceof TargetCard)) {
Card attachedToCard = game.getCard(this.getAttachedTo());
if (attachedToCard != null) {