- Fixing NPE in IsPlayer()

This commit is contained in:
Sol
2011-08-22 03:38:48 +00:00
parent c51797280d
commit 8451aa99a4
3 changed files with 4 additions and 7 deletions

View File

@@ -67,11 +67,6 @@ public class AIPlayer extends Player {
return true; return true;
} }
/** {@inheritDoc} */
public boolean isPlayer(Player p1) {
return p1.getName().equals(this.name);
}
/////////////// ///////////////
/// ///
/// End transition methods /// End transition methods

View File

@@ -68,7 +68,7 @@ public class HumanPlayer extends Player {
/** {@inheritDoc} */ /** {@inheritDoc} */
public boolean isPlayer(Player p1) { public boolean isPlayer(Player p1) {
return p1.getName().equals(this.name); return p1 != null && p1.getName().equals(this.name);
} }
/////////////// ///////////////

View File

@@ -127,7 +127,9 @@ public abstract class Player extends MyObservable {
* @param p1 a {@link forge.Player} object. * @param p1 a {@link forge.Player} object.
* @return a boolean. * @return a boolean.
*/ */
public abstract boolean isPlayer(Player p1); public boolean isPlayer(Player p1) {
return p1 != null && p1.getName().equals(this.name);
}
/** /**
* <p>getOpponent.</p> * <p>getOpponent.</p>