mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Bounds check empty permutations
If the length is 0 or malformed input, we return empty.
This commit is contained in:
parent
1f3d3112d3
commit
7629d3f887
1 changed files with 1 additions and 1 deletions
|
@ -125,7 +125,7 @@ namespace PKHeX.Core
|
|||
private static IEnumerable<IEnumerable<T>> GetPermutations<T>(ICollection<T> list, int length)
|
||||
{
|
||||
// https://stackoverflow.com/a/10630026
|
||||
if (length == 1)
|
||||
if ((uint)length <= 1)
|
||||
return list.Select(t => new[] { t });
|
||||
|
||||
return GetPermutations(list, length - 1)
|
||||
|
|
Loading…
Add table
Reference in a new issue