mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
Removed potential integer overflow.
If the number passed into max is Integer.MAX_VALUE, like it is with ChoiceOfDamnation, the random number will overflow. So let's not do that.
This commit is contained in:
parent
4a9eddb724
commit
2ecb415b4d
1 changed files with 1 additions and 1 deletions
|
|
@ -1543,7 +1543,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
||||||
}
|
}
|
||||||
//TODO: improve this
|
//TODO: improve this
|
||||||
if (min < max && min == 0) {
|
if (min < max && min == 0) {
|
||||||
return RandomUtil.nextInt(max + 1);
|
return RandomUtil.nextInt(max);
|
||||||
}
|
}
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue