From 94ae1be2d1fa1d4a19e83816f22029d0d0b1e9a8 Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 8 Mar 2016 12:42:23 -0500 Subject: [PATCH] Fix NPE when using //schem list with not schematics present. --- .../com/sk89q/worldedit/command/SchematicCommands.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index 9bc9de49d..9439f8184 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -262,14 +262,15 @@ public class SchematicCommands { public void list(Actor actor, CommandContext args, @Switch('p') @Optional("1") int page) throws WorldEditException { File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir); List fileList = allFiles(dir); - File[] files = new File[fileList.size()]; - fileList.toArray(files); - if (files.length == 0) { + if (fileList.isEmpty()) { actor.printError("No schematics found."); return; } + File[] files = new File[fileList.size()]; + fileList.toArray(files); + int pageCount = files.length / SCHEMATICS_PER_PAGE + 1; if (page < 1) { actor.printError("Page must be at least 1");