mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Fixed possible IndexOutOfBoundsException in chooseCardsToRevealFromHand.
This commit is contained in:
@@ -347,7 +347,8 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Card> chooseCardsToRevealFromHand(int min, int max, List<Card> valid) {
|
public List<Card> chooseCardsToRevealFromHand(int min, int max, List<Card> valid) {
|
||||||
return max == 0 ? Lists.<Card>newArrayList() : valid.subList(0, max);
|
int numCardsToReveal = Math.min(max, valid.size());
|
||||||
|
return numCardsToReveal == 0 ? Lists.<Card>newArrayList() : valid.subList(0, numCardsToReveal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user