Fixed freeze and npe error while disconnects on choose target dialog;
@@ -269,7 +269,11 @@ public abstract class TargetImpl implements Target {
@Override
public boolean choose(Outcome outcome, UUID playerId, UUID sourceId, Game game) {
Player player = game.getPlayer(playerId);
+ if (player != null) {
while (!isChosen() && !doneChosing()) {
+ if (!player.canRespond()) {
+ return chosen = targets.size() >= getNumberOfTargets();
+ }
chosen = targets.size() >= getNumberOfTargets();
if (!player.choose(outcome, this, sourceId, game)) {
return chosen;
@@ -278,6 +282,8 @@ public abstract class TargetImpl implements Target {
}
return chosen = true;
}
+ return false;
+ }
@Override
public boolean chooseTarget(Outcome outcome, UUID playerId, Ability source, Game game) {
