Defend against trap if renderdata/ directory doesn't exist (deleted by user)

This commit is contained in:
Mike Primm 2011-10-29 22:25:11 +08:00 committed by mikeprimm
parent 0cedeac3eb
commit 2012c63921
2 changed files with 29 additions and 25 deletions

View file

@ -293,6 +293,7 @@ public class HDBlockModels {
} }
File customdir = new File(datadir, "renderdata"); File customdir = new File(datadir, "renderdata");
String[] files = customdir.list(); String[] files = customdir.list();
if(files != null) {
for(String fn : files) { for(String fn : files) {
if(fn.endsWith("-models.txt") == false) if(fn.endsWith("-models.txt") == false)
continue; continue;
@ -312,6 +313,7 @@ public class HDBlockModels {
} }
} }
} }
}
/** /**
* Load models from file * Load models from file
*/ */

View file

@ -788,6 +788,7 @@ public class TexturePack {
File renderdir = new File(datadir, "renderdata"); File renderdir = new File(datadir, "renderdata");
String[] files = renderdir.list(); String[] files = renderdir.list();
if(files != null) {
for(String fname : files) { for(String fname : files) {
if(fname.endsWith("-texture.txt")) { if(fname.endsWith("-texture.txt")) {
File custom = new File(renderdir, fname); File custom = new File(renderdir, fname);
@ -804,6 +805,7 @@ public class TexturePack {
} }
} }
} }
}
/** /**
* Load texture pack mappings from texture.txt file * Load texture pack mappings from texture.txt file