mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Fixed freeze and npe error while disconnects on choose target dialog;
This commit is contained in:
parent
188de12592
commit
b432b4b431
1 changed files with 12 additions and 6 deletions
|
@ -269,7 +269,11 @@ public abstract class TargetImpl implements Target {
|
||||||
@Override
|
@Override
|
||||||
public boolean choose(Outcome outcome, UUID playerId, UUID sourceId, Game game) {
|
public boolean choose(Outcome outcome, UUID playerId, UUID sourceId, Game game) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player != null) {
|
||||||
while (!isChosen() && !doneChosing()) {
|
while (!isChosen() && !doneChosing()) {
|
||||||
|
if (!player.canRespond()) {
|
||||||
|
return chosen = targets.size() >= getNumberOfTargets();
|
||||||
|
}
|
||||||
chosen = targets.size() >= getNumberOfTargets();
|
chosen = targets.size() >= getNumberOfTargets();
|
||||||
if (!player.choose(outcome, this, sourceId, game)) {
|
if (!player.choose(outcome, this, sourceId, game)) {
|
||||||
return chosen;
|
return chosen;
|
||||||
|
@ -278,6 +282,8 @@ public abstract class TargetImpl implements Target {
|
||||||
}
|
}
|
||||||
return chosen = true;
|
return chosen = true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseTarget(Outcome outcome, UUID playerId, Ability source, Game game) {
|
public boolean chooseTarget(Outcome outcome, UUID playerId, Ability source, Game game) {
|
||||||
|
|
Loading…
Reference in a new issue