Guardian Project - fixed game error on usage (NPE, closes #10055)

This commit is contained in:
Oleg Agafonov 2023-06-17 00:48:44 +04:00
parent 0ce6df9ef7
commit 8322d75fc0

View file

@ -67,7 +67,7 @@ class GuardianProjectTriggeredAbility extends EntersBattlefieldAllTriggeredAbili
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (!filter.match(permanent, controllerId, this, game)) {
if (permanent == null || !filter.match(permanent, controllerId, this, game)) {
return false;
}
@ -133,12 +133,11 @@ class GuardianProjectEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
Permanent permanent = mor.getPermanentOrLKIBattlefield(game);
if (player == null || permanent == null) {
return false;
}
if (GuardianProjectTriggeredAbility.checkCondition(
mor.getPermanentOrLKIBattlefield(game), source.getControllerId(), game)
) {
if (GuardianProjectTriggeredAbility.checkCondition(permanent, source.getControllerId(), game)) {
player.drawCards(1, source, game);
return true;
}