diff --git a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java index f6dbe43a2d..f324e03034 100644 --- a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java @@ -40,6 +40,7 @@ import mage.abilities.mana.ManaAbility; import mage.constants.Zone; import mage.game.Game; import mage.util.ThreadLocalStringBuilder; +import org.apache.log4j.Logger; /** * @@ -47,6 +48,8 @@ import mage.util.ThreadLocalStringBuilder; * @param */ public class AbilitiesImpl extends ArrayList implements Abilities { + + private static final Logger logger = Logger.getLogger(AbilitiesImpl.class); private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(200); @@ -102,8 +105,12 @@ public class AbilitiesImpl extends ArrayList implements Ab rules.add(sbRule.toString()); } String rule = ability.getRule(); - if (rule != null && rule.length() > 0) { - rules.add(Character.toUpperCase(rule.charAt(0)) + rule.substring(1)); + if (rule != null) { + if (rule.length() > 0) { + rules.add(Character.toUpperCase(rule.charAt(0)) + rule.substring(1)); + } + } else { // logging so we can still can be made aware of rule problems a card has + logger.fatal("Error in rule text generation of " + source + ": Create a bug report or fix the source code"); } } } diff --git a/Mage/src/main/java/mage/abilities/keyword/AwakenAbility.java b/Mage/src/main/java/mage/abilities/keyword/AwakenAbility.java index ff07f0d549..4957921196 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AwakenAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AwakenAbility.java @@ -51,12 +51,15 @@ import mage.target.Target; import mage.target.common.TargetControlledPermanent; import mage.target.targetpointer.FixedTarget; import mage.util.CardUtil; +import org.apache.log4j.Logger; /** * * @author LevelX2 */ public class AwakenAbility extends SpellAbility { + + private static final Logger logger = Logger.getLogger(AwakenAbility.class); static private String filterMessage = "a land you control to awake"; @@ -135,6 +138,12 @@ public class AwakenAbility extends SpellAbility { effect.setTargetPointer(fixedTarget); return effect.apply(game, source); } + } else { // source should never be null, but we are seeing a lot of NPEs from this section + if (source == null) { + logger.fatal("Source was null in AwakenAbility: Create a bug report or fix the source code"); + } else if (source.getTargets() == null) { + logger.fatal("getTargets was null in AwakenAbility for " + source + " : Create a bug report or fix the source code"); + } } return true; }