mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
try\catch around NPE on server
This commit is contained in:
parent
36bc35f7b2
commit
2e890bea0c
1 changed files with 13 additions and 1 deletions
|
@ -74,9 +74,12 @@ import mage.players.net.UserData;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
import mage.target.common.TargetDiscard;
|
import mage.target.common.TargetDiscard;
|
||||||
import mage.watchers.common.BloodthirstWatcher;
|
import mage.watchers.common.BloodthirstWatcher;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Serializable {
|
public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Serializable {
|
||||||
|
|
||||||
|
private static final transient Logger log = Logger.getLogger(PlayerImpl.class);
|
||||||
|
|
||||||
private static Random rnd = new Random();
|
private static Random rnd = new Random();
|
||||||
|
|
||||||
protected boolean abort;
|
protected boolean abort;
|
||||||
|
@ -629,7 +632,16 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
||||||
public boolean triggerAbility(TriggeredAbility source, Game game) {
|
public boolean triggerAbility(TriggeredAbility source, Game game) {
|
||||||
//20091005 - 603.3c, 603.3d
|
//20091005 - 603.3c, 603.3d
|
||||||
int bookmark = game.bookmarkState();
|
int bookmark = game.bookmarkState();
|
||||||
TriggeredAbility ability = (TriggeredAbility) source.copy();
|
//FIXME: remove try\catch once we find out the reason for NPE on server
|
||||||
|
TriggeredAbility ability = null;
|
||||||
|
try {
|
||||||
|
ability = (TriggeredAbility) source.copy();
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
log.fatal("NPE for source=" + source);
|
||||||
|
if (source != null) {
|
||||||
|
log.fatal("NPE for source=" + source.getRule());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ability != null && ability.canChooseTarget(game)) {
|
if (ability != null && ability.canChooseTarget(game)) {
|
||||||
if (ability.isUsesStack()) {
|
if (ability.isUsesStack()) {
|
||||||
game.getStack().push(new StackAbility(ability, playerId));
|
game.getStack().push(new StackAbility(ability, playerId));
|
||||||
|
|
Loading…
Reference in a new issue