handle bad biome files on load, instead of waiting for an IndexError later
related to <https://github.com/brownan/Minecraft-Overviewer/issues/301>
This commit is contained in:
@@ -878,14 +878,17 @@ def getBiomeData(worlddir, chunkX, chunkY):
|
||||
if biomeFile == currentBiomeFile:
|
||||
return currentBiomeData
|
||||
|
||||
currentBiomeFile = biomeFile
|
||||
|
||||
f = open(os.path.join(worlddir, "biomes", biomeFile), "rb")
|
||||
rawdata = f.read()
|
||||
f.close()
|
||||
|
||||
|
||||
# make sure the file size is correct
|
||||
if not len(rawdata) == 512 * 512 * 2:
|
||||
raise Exception("Biome file %s is not valid." % (biomeFile,))
|
||||
|
||||
data = numpy.frombuffer(rawdata, dtype=numpy.dtype(">u2"))
|
||||
|
||||
currentBiomeFile = biomeFile
|
||||
currentBiomeData = data
|
||||
return data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user