* 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,13 +1225,17 @@ 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().equals(sourceId)) { if (ability.getSourceId() != null) {
if (controllerFound == null || controllerFound == ability.getControllerId()) { if (ability.getSourceId().equals(sourceId)) {
controllerFound = ability.getControllerId(); if (controllerFound == null || controllerFound == ability.getControllerId()) {
} else { controllerFound = ability.getControllerId();
// not unique controller - No solution yet } else {
return null; // not unique controller - No solution yet
return null;
}
} }
} else {
logger.warn("Ability without sourceId:" + ability.getRule());
} }
} }
} }