From 4d1d96863bd8028dbb7b21d68a1914bf6f551a8d Mon Sep 17 00:00:00 2001 From: David Vierra Date: Fri, 30 Nov 2012 16:35:39 -1000 Subject: [PATCH] Catch struct errors when checking session lock. --- infiniteworld.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/infiniteworld.py b/infiniteworld.py index 3b3920f..1161755 100644 --- a/infiniteworld.py +++ b/infiniteworld.py @@ -1091,7 +1091,10 @@ class MCInfdevOldLevel(ChunkedLevelMixin, EntityLevel): def checkSessionLock(self): lockfile = self.worldFolder.getFilePath("session.lock") - (lock, ) = struct.unpack(">q", file(lockfile, "rb").read()) + try: + (lock, ) = struct.unpack(">q", file(lockfile, "rb").read()) + except struct.error: + lock = -1 if lock != self.initTime: raise SessionLockLost, "Session lock lost. This world is being accessed from another location."