* ManaSpentToCastWatcher - Fixed possible null pointer exception.

This commit is contained in:
LevelX2 2015-09-06 22:14:35 +02:00
parent b8f0c38101
commit 7aa27a9800

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.watchers.common;
import mage.Mana;
@ -60,7 +59,7 @@ public class ManaSpentToCastWatcher extends Watcher {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.HAND) {
Spell spell = (Spell) game.getObject(event.getTargetId());
if (this.getSourceId().equals(spell.getSourceId())) {
if (spell != null && this.getSourceId().equals(spell.getSourceId())) {
payment = spell.getSpellAbility().getManaCostsToPay().getPayment();
}
}