Handle int overflow in SetExpFix

This commit is contained in:
Alexander Schepp 2012-10-31 21:06:30 +01:00
parent 4d4779ecdc
commit 4dc2e2e3fd

View File

@ -67,6 +67,10 @@ public class SetExpFix
exp += getExpAtLevel(currentLevel);
currentLevel++;
}
if (exp < 0)
{
exp = Integer.MAX_VALUE;
}
return exp;
}
@ -82,6 +86,10 @@ public class SetExpFix
currentLevel--;
exp += getExpAtLevel(currentLevel);
}
if (exp < 0)
{
exp = Integer.MAX_VALUE;
}
return exp;
}