Fix an IndexOutOfBoundsException when using /mctop

Fixed #861
This commit is contained in:
TfT_02 2013-03-22 17:38:52 +01:00
parent 8cf16d4a1c
commit c47bf84493

View File

@ -188,12 +188,17 @@ public final class LeaderboardManager {
statsList = playerStatHash.get(SkillType.getSkill(skillType)); statsList = playerStatHash.get(SkillType.getSkill(skillType));
} }
if (pageNumber < 1) {
pageNumber = 1;
}
int destination = (pageNumber - 1) * 10; int destination = (pageNumber - 1) * 10;
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
if (destination + i < statsList.size()) {
PlayerStat ps = statsList.get(destination + i); PlayerStat ps = statsList.get(destination + i);
info[i] = ps.name + ":" + ps.statVal; info[i] = ps.name + ":" + ps.statVal;
} }
}
return info; return info;
} }