Fixed NPE which happened on occasion during AI simulations.

This commit is contained in:
maurer.it 2011-03-16 13:21:14 -04:00
parent 7698581116
commit ff3e0108cd

View file

@ -94,17 +94,21 @@ class VampireHexmageEffect extends OneShotEffect<VampireHexmageEffect> {
Permanent permanent = game.getPermanent(target.getFirstTarget());
String[ ] counterNames = permanent.getCounters().keySet().toArray(new String[0]);
if ( permanent != null ) {
String[ ] counterNames = permanent.getCounters().keySet().toArray(new String[0]);
if ( permanent.getLoyalty() != null ) {
permanent.getLoyalty().setValue(0);
}
if ( permanent.getLoyalty() != null ) {
permanent.getLoyalty().setValue(0);
}
for ( String counterName : counterNames ) {
permanent.getCounters().remove(counterName);
}
for ( String counterName : counterNames ) {
permanent.getCounters().remove(counterName);
}
return true;
}
return true;
return false;
}
}