From 8716c8994b3d6f79e0933d98f5e91523d2d5e214 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Mon, 29 Nov 2010 21:37:56 -1000 Subject: [PATCH] actually raise the ChunkMalformed instead of an AttributeError when world isn't found this is kinda sketchy --- mclevel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mclevel.py b/mclevel.py index 48f614a..672ad62 100644 --- a/mclevel.py +++ b/mclevel.py @@ -340,6 +340,7 @@ class MCLevel(object): players = ["Player"] dimNo = 0; parentWorld = None + world = None @classmethod def isLevel(cls, filename): """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')); except Exception, 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 try: self.shapeChunkData() except KeyError: 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 self.dataIsPacked = True;