3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-02 17:40:09 +01:00

NullPointer fix for /schematic list (#781)

* fixed null pointer

* fixed rest of similarly caused null pointers

* checkstyle
Dieser Commit ist enthalten in:
Ivan Volkov 2020-12-13 09:20:10 -05:00 committet von GitHub
Ursprung bfc657d3f6
Commit 04ba545aa2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -601,11 +601,14 @@ public class SchematicCommands {
long totalBytes = 0;
File parentDir = new File(dir.getAbsolutePath() + (playerFolder ? File.separator + uuid.toString() : ""));
try {
for (File schem : getFiles(parentDir, null, null)) {
List<File> toAddUp = getFiles(parentDir, null, null);
if (toAddUp != null && toAddUp.size() != 0) {
for (File schem : toAddUp) {
if (schem.getName().endsWith(".schem") || schem.getName().endsWith(".schematic")) {
totalBytes += Files.size(Paths.get(schem.getAbsolutePath()));
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
@ -736,15 +739,15 @@ public class SchematicCommands {
int numFiles = -1;
if (checkFilesize) {
File parentDir = new File(file.getParent());
for (File child : getFiles(rootDir, null, null)) {
List<File> toAddUp = getFiles(rootDir, null, null);
if (toAddUp != null && toAddUp.size() != 0) {
for (File child : toAddUp) {
if (child.getName().endsWith(".schem") || child.getName().endsWith(".schematic")) {
directorysizeKb += Files.size(Paths.get(child.getAbsolutePath())) / 1000.0;
numFiles++;
}
}
}
if (overwrite) {
oldKbOverwritten = Files.size(Paths.get(file.getAbsolutePath())) / 1000.0;
int iter = 1;
@ -760,12 +763,15 @@ public class SchematicCommands {
if (numFiles == -1) {
numFiles = 0;
for (File child : getFiles(rootDir, null, null)) {
List<File> toAddUp = getFiles(rootDir, null, null);
if (toAddUp != null && toAddUp.size() != 0) {
for (File child : toAddUp) {
if (child.getName().endsWith(".schem") || child.getName().endsWith(".schematic")) {
numFiles++;
}
}
}
}
int limit = Settings.IMP.EXPERIMENTAL.PER_PLAYER_FILE_NUM_LIMIT;
if (numFiles >= limit) {