Fix NPE when using //schem list with not schematics present.

Dieser Commit ist enthalten in:
wizjany 2016-03-08 12:42:23 -05:00
Ursprung 6c03eea9b1
Commit 94ae1be2d1

Datei anzeigen

@ -262,14 +262,15 @@ public class SchematicCommands {
public void list(Actor actor, CommandContext args, @Switch('p') @Optional("1") int page) throws WorldEditException { public void list(Actor actor, CommandContext args, @Switch('p') @Optional("1") int page) throws WorldEditException {
File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir); File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir);
List<File> fileList = allFiles(dir); List<File> fileList = allFiles(dir);
File[] files = new File[fileList.size()];
fileList.toArray(files);
if (files.length == 0) { if (fileList.isEmpty()) {
actor.printError("No schematics found."); actor.printError("No schematics found.");
return; return;
} }
File[] files = new File[fileList.size()];
fileList.toArray(files);
int pageCount = files.length / SCHEMATICS_PER_PAGE + 1; int pageCount = files.length / SCHEMATICS_PER_PAGE + 1;
if (page < 1) { if (page < 1) {
actor.printError("Page must be at least 1"); actor.printError("Page must be at least 1");