From d7c1b8b0e2aad5b11a58fbb5162ff6d2f6331f0d Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Sun, 11 Dec 2011 12:02:01 -0700 Subject: [PATCH] Fix AIOOB. Fixes #303 Fixed an AIOOB when players had the list perm, but not perm to view any world. --- .../onarandombox/MultiverseCore/commands/PaginatedCommand.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/PaginatedCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/PaginatedCommand.java index 247a04ee..bad5a805 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/PaginatedCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/PaginatedCommand.java @@ -42,8 +42,11 @@ public abstract class PaginatedCommand extends Command { } protected void showPage(int page, CommandSender sender, List cmds) { + // Ensure the page is at least 1. + page = (page <= 0) ? 1 : page; int start = (page - 1) * ITEMS_PER_PAGE; int end = start + ITEMS_PER_PAGE; + for (int i = start; i < end; i++) { // For consistancy, print some extra lines if it's a player: if (i < cmds.size()) {