Fix index out of bounds with multiple targets.

This commit is contained in:
Myrd
2015-02-13 05:24:25 +00:00
parent edbbc582c7
commit cad21523ff

View File

@@ -40,7 +40,7 @@ public class PossibleTargetSelector {
} }
sa.resetTargets(); sa.resetTargets();
int index = targetIndex; int index = targetIndex;
while (sa.getTargets().getNumTargeted() < tgt.getMaxTargets(sa.getHostCard(), sa)) { while (sa.getTargets().getNumTargeted() < tgt.getMaxTargets(sa.getHostCard(), sa) && index < validTargets.size()) {
sa.getTargets().add(validTargets.get(index++)); sa.getTargets().add(validTargets.get(index++));
} }
// TODO: smarter about multiple targets, identical targets, etc... // TODO: smarter about multiple targets, identical targets, etc...