mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-14 14:25:21 +01:00
Defend against trap if renderdata/ directory doesn't exist (deleted by user)
This commit is contained in:
parent
2eb6d47d87
commit
ca62003e06
@ -293,20 +293,22 @@ public class HDBlockModels {
|
||||
}
|
||||
File customdir = new File(datadir, "renderdata");
|
||||
String[] files = customdir.list();
|
||||
for(String fn : files) {
|
||||
if(fn.endsWith("-models.txt") == false)
|
||||
continue;
|
||||
File custom = new File(customdir, fn);
|
||||
if(custom.canRead()) {
|
||||
try {
|
||||
in = new FileInputStream(custom);
|
||||
loadModelFile(in, custom.getPath());
|
||||
} catch (IOException iox) {
|
||||
Log.severe("Error loading " + custom.getPath());
|
||||
} finally {
|
||||
if(in != null) {
|
||||
try { in.close(); } catch (IOException iox) {}
|
||||
in = null;
|
||||
if(files != null) {
|
||||
for(String fn : files) {
|
||||
if(fn.endsWith("-models.txt") == false)
|
||||
continue;
|
||||
File custom = new File(customdir, fn);
|
||||
if(custom.canRead()) {
|
||||
try {
|
||||
in = new FileInputStream(custom);
|
||||
loadModelFile(in, custom.getPath());
|
||||
} catch (IOException iox) {
|
||||
Log.severe("Error loading " + custom.getPath());
|
||||
} finally {
|
||||
if(in != null) {
|
||||
try { in.close(); } catch (IOException iox) {}
|
||||
in = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -788,17 +788,19 @@ public class TexturePack {
|
||||
|
||||
File renderdir = new File(datadir, "renderdata");
|
||||
String[] files = renderdir.list();
|
||||
for(String fname : files) {
|
||||
if(fname.endsWith("-texture.txt")) {
|
||||
File custom = new File(renderdir, fname);
|
||||
if(custom.canRead()) {
|
||||
try {
|
||||
in = new FileInputStream(custom);
|
||||
loadTextureFile(in, custom.getPath());
|
||||
} catch (IOException iox) {
|
||||
Log.severe("Error loading " + custom.getPath() + " - " + iox);
|
||||
} finally {
|
||||
if(in != null) { try { in.close(); } catch (IOException x) {} in = null; }
|
||||
if(files != null) {
|
||||
for(String fname : files) {
|
||||
if(fname.endsWith("-texture.txt")) {
|
||||
File custom = new File(renderdir, fname);
|
||||
if(custom.canRead()) {
|
||||
try {
|
||||
in = new FileInputStream(custom);
|
||||
loadTextureFile(in, custom.getPath());
|
||||
} catch (IOException iox) {
|
||||
Log.severe("Error loading " + custom.getPath() + " - " + iox);
|
||||
} finally {
|
||||
if(in != null) { try { in.close(); } catch (IOException x) {} in = null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user