actually raise the ChunkMalformed instead of an AttributeError when world isn't found
this is kinda sketchy
This commit is contained in:
parent
5bee90b002
commit
8716c8994b
@ -340,6 +340,7 @@ class MCLevel(object):
|
|||||||
players = ["Player"]
|
players = ["Player"]
|
||||||
dimNo = 0;
|
dimNo = 0;
|
||||||
parentWorld = None
|
parentWorld = None
|
||||||
|
world = None
|
||||||
@classmethod
|
@classmethod
|
||||||
def isLevel(cls, filename):
|
def isLevel(cls, filename):
|
||||||
"""Tries to find out whether the given filename can be loaded
|
"""Tries to find out whether the given filename can be loaded
|
||||||
@ -425,14 +426,14 @@ class MCLevel(object):
|
|||||||
self.root_tag = nbt.load(buf=fromstring(data, dtype='uint8'));
|
self.root_tag = nbt.load(buf=fromstring(data, dtype='uint8'));
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
error( u"Malformed NBT data in file: {0} ({1})".format(self.filename, e) )
|
error( u"Malformed NBT data in file: {0} ({1})".format(self.filename, e) )
|
||||||
self.world.malformedChunk(*self.chunkPosition);
|
if self.world: self.world.malformedChunk(*self.chunkPosition);
|
||||||
raise ChunkMalformed, self.filename
|
raise ChunkMalformed, self.filename
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.shapeChunkData()
|
self.shapeChunkData()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
error( u"Incorrect chunk format in file: " + self.filename )
|
error( u"Incorrect chunk format in file: " + self.filename )
|
||||||
self.world.malformedChunk(*self.chunkPosition);
|
if self.world: self.world.malformedChunk(*self.chunkPosition);
|
||||||
raise ChunkMalformed, self.filename
|
raise ChunkMalformed, self.filename
|
||||||
|
|
||||||
self.dataIsPacked = True;
|
self.dataIsPacked = True;
|
||||||
|
Reference in New Issue
Block a user