* Fixed possible NPE and added warning to log to check what abilities have no sourceId (fixes #1261).

This commit is contained in:
LevelX2 2015-09-13 07:55:04 +02:00
parent b29fe86aa0
commit 7639f1bc6d

View file

@ -1225,6 +1225,7 @@ public class ContinuousEffects implements Serializable {
for (ReplacementEffect effect : replacementEffects) { for (ReplacementEffect effect : replacementEffects) {
HashSet<Ability> abilities = replacementEffects.getAbility(effect.getId()); HashSet<Ability> abilities = replacementEffects.getAbility(effect.getId());
for (Ability ability : abilities) { for (Ability ability : abilities) {
if (ability.getSourceId() != null) {
if (ability.getSourceId().equals(sourceId)) { if (ability.getSourceId().equals(sourceId)) {
if (controllerFound == null || controllerFound == ability.getControllerId()) { if (controllerFound == null || controllerFound == ability.getControllerId()) {
controllerFound = ability.getControllerId(); controllerFound = ability.getControllerId();
@ -1233,6 +1234,9 @@ public class ContinuousEffects implements Serializable {
return null; return null;
} }
} }
} else {
logger.warn("Ability without sourceId:" + ability.getRule());
}
} }
} }
return controllerFound; return controllerFound;