Fixed McRegionReader not being closed.

This commit is contained in:
sk89q 2011-03-09 23:55:44 -08:00
parent 1d68fdd11c
commit 49b4c190f9

View File

@ -48,8 +48,15 @@ public abstract class McRegionChunkStore extends ChunkStore {
protected McRegionReader getReader(Vector2D pos) throws DataException, IOException { protected McRegionReader getReader(Vector2D pos) throws DataException, IOException {
String filename = getFilename(pos); String filename = getFilename(pos);
if (curFilename != null && curFilename.equals(filename)) { if (curFilename != null) {
if (curFilename.equals(filename)) {
return cachedReader; return cachedReader;
} else {
try {
cachedReader.close();
} catch (IOException e) {
}
}
} }
InputStream stream = getInputStream(filename); InputStream stream = getInputStream(filename);
cachedReader = new McRegionReader(stream); cachedReader = new McRegionReader(stream);