Fix Clash effect causing NullPointerExceptions (#10742)

This commit is contained in:
Susucre 2023-08-04 04:11:59 +02:00 committed by GitHub
parent 005f32cfff
commit 4d3b944b65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 16 deletions

View file

@ -4,6 +4,7 @@ import mage.abilities.MageSingleton;
import mage.abilities.Mode;
import mage.constants.EffectType;
import mage.constants.Outcome;
import mage.players.Player;
import mage.target.targetpointer.FirstTargetPointer;
import mage.target.targetpointer.TargetPointer;
@ -104,6 +105,12 @@ public abstract class EffectImpl implements Effect {
values = new HashMap<>();
}
}
if (value instanceof Player) {
// If Player are set as value, there might be PlayerImpl serialized in ClientMessage's GameView.
// That does cause the message's data to not be unzippable, since the PlayerImpl class are not
// client-side.
throw new IllegalArgumentException("Players should not be set as value, set the UUID instead.");
}
values.put(key, value);
}