mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
NullPointer fix for /schematic list (#781)
* fixed null pointer * fixed rest of similarly caused null pointers * checkstyle
This commit is contained in:
parent
bfc657d3f6
commit
04ba545aa2
@ -601,9 +601,12 @@ public class SchematicCommands {
|
|||||||
long totalBytes = 0;
|
long totalBytes = 0;
|
||||||
File parentDir = new File(dir.getAbsolutePath() + (playerFolder ? File.separator + uuid.toString() : ""));
|
File parentDir = new File(dir.getAbsolutePath() + (playerFolder ? File.separator + uuid.toString() : ""));
|
||||||
try {
|
try {
|
||||||
for (File schem : getFiles(parentDir, null, null)) {
|
List<File> toAddUp = getFiles(parentDir, null, null);
|
||||||
if (schem.getName().endsWith(".schem") || schem.getName().endsWith(".schematic")) {
|
if (toAddUp != null && toAddUp.size() != 0) {
|
||||||
totalBytes += Files.size(Paths.get(schem.getAbsolutePath()));
|
for (File schem : toAddUp) {
|
||||||
|
if (schem.getName().endsWith(".schem") || schem.getName().endsWith(".schematic")) {
|
||||||
|
totalBytes += Files.size(Paths.get(schem.getAbsolutePath()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -736,15 +739,15 @@ public class SchematicCommands {
|
|||||||
|
|
||||||
int numFiles = -1;
|
int numFiles = -1;
|
||||||
if (checkFilesize) {
|
if (checkFilesize) {
|
||||||
File parentDir = new File(file.getParent());
|
List<File> toAddUp = getFiles(rootDir, null, null);
|
||||||
|
if (toAddUp != null && toAddUp.size() != 0) {
|
||||||
for (File child : getFiles(rootDir, null, null)) {
|
for (File child : toAddUp) {
|
||||||
if (child.getName().endsWith(".schem") || child.getName().endsWith(".schematic")) {
|
if (child.getName().endsWith(".schem") || child.getName().endsWith(".schematic")) {
|
||||||
directorysizeKb += Files.size(Paths.get(child.getAbsolutePath())) / 1000.0;
|
directorysizeKb += Files.size(Paths.get(child.getAbsolutePath())) / 1000.0;
|
||||||
numFiles++;
|
numFiles++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overwrite) {
|
if (overwrite) {
|
||||||
oldKbOverwritten = Files.size(Paths.get(file.getAbsolutePath())) / 1000.0;
|
oldKbOverwritten = Files.size(Paths.get(file.getAbsolutePath())) / 1000.0;
|
||||||
int iter = 1;
|
int iter = 1;
|
||||||
@ -760,9 +763,12 @@ public class SchematicCommands {
|
|||||||
|
|
||||||
if (numFiles == -1) {
|
if (numFiles == -1) {
|
||||||
numFiles = 0;
|
numFiles = 0;
|
||||||
for (File child : getFiles(rootDir, null, null)) {
|
List<File> toAddUp = getFiles(rootDir, null, null);
|
||||||
if (child.getName().endsWith(".schem") || child.getName().endsWith(".schematic")) {
|
if (toAddUp != null && toAddUp.size() != 0) {
|
||||||
numFiles++;
|
for (File child : toAddUp) {
|
||||||
|
if (child.getName().endsWith(".schem") || child.getName().endsWith(".schematic")) {
|
||||||
|
numFiles++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user