RPTools/dicelib

ArrayIndexOutOfBoundsException thrown by keepDice if keep > times

selquest opened this issue · 0 comments

Pointed out by daxx367 on discord:

Calling keep(2,6,4) produces an ArrayIndexOutOfBoundsException because it does not check that keep <= times before calling the dropDice() function.

return dropDice(times, sides, times - keep);

The keepLowestDice() function has the same problem:

return dropDiceHighest(times, sides, times - keep);

I'll have a PR fixing this shortly.