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

This commit is contained in:
wizjany 2016-03-08 12:42:23 -05:00
parent 6c03eea9b1
commit 94ae1be2d1

View File

@ -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<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.");
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");