From c47bf844933bbe87dbfd74ba05dc80bf1f708076 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Fri, 22 Mar 2013 17:38:52 +0100 Subject: [PATCH] Fix an IndexOutOfBoundsException when using /mctop Fixed #861 --- .../com/gmail/nossr50/database/LeaderboardManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/database/LeaderboardManager.java b/src/main/java/com/gmail/nossr50/database/LeaderboardManager.java index fea4337de..cd21c9456 100644 --- a/src/main/java/com/gmail/nossr50/database/LeaderboardManager.java +++ b/src/main/java/com/gmail/nossr50/database/LeaderboardManager.java @@ -188,11 +188,16 @@ public final class LeaderboardManager { statsList = playerStatHash.get(SkillType.getSkill(skillType)); } + if (pageNumber < 1) { + pageNumber = 1; + } int destination = (pageNumber - 1) * 10; for (int i = 0; i < 10; i++) { - PlayerStat ps = statsList.get(destination + i); - info[i] = ps.name + ":" + ps.statVal; + if (destination + i < statsList.size()) { + PlayerStat ps = statsList.get(destination + i); + info[i] = ps.name + ":" + ps.statVal; + } } return info;