diff --git a/src/main/java/org/dynmap/hdmap/HDBlockModels.java b/src/main/java/org/dynmap/hdmap/HDBlockModels.java index 587558a9..62c6599c 100644 --- a/src/main/java/org/dynmap/hdmap/HDBlockModels.java +++ b/src/main/java/org/dynmap/hdmap/HDBlockModels.java @@ -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; + } } } } diff --git a/src/main/java/org/dynmap/hdmap/TexturePack.java b/src/main/java/org/dynmap/hdmap/TexturePack.java index cde03f19..442af970 100644 --- a/src/main/java/org/dynmap/hdmap/TexturePack.java +++ b/src/main/java/org/dynmap/hdmap/TexturePack.java @@ -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; } + } } } }