Bounds check ability requested

no longer exception's on RefreshAbility(negative number)
This commit is contained in:
Kurt 2020-06-21 18:16:18 -05:00
parent 6b506957c9
commit fc4ba1df35
2 changed files with 2 additions and 2 deletions

View File

@ -85,7 +85,7 @@ public int GetGender(int gender, PersonalInfo pkPersonalInfo)
public int GetAbility(int abilityType, PersonalInfo pkPersonalInfo)
{
if (abilityType < 3)
if ((uint)abilityType < 3)
return abilityType;
var abils = pkPersonalInfo.Abilities;

View File

@ -756,7 +756,7 @@ public void RefreshAbility(int n)
{
AbilityNumber = 1 << n;
int[] abilities = PersonalInfo.Abilities;
if (n < abilities.Length)
if ((uint)n < abilities.Length)
{
if (abilities[n] == abilities[0])
n = 0;