Ignore empty LocalStatus files

I created new IMAP folders on my server. In some moment I found offlineimap
crashed. The reason were empty LocalStatus files. From looking at the code I
have no explanation how those files came into existence.
This commit is contained in:
Florian Friesdorf 2008-03-20 13:15:37 +01:00 committed by John Goerzen
parent cd04e2e03e
commit b18f55a7e2

View File

@ -67,6 +67,11 @@ class LocalStatusFolder(BaseFolder):
file = open(self.filename, "rt") file = open(self.filename, "rt")
self.messagelist = {} self.messagelist = {}
line = file.readline().strip() line = file.readline().strip()
if not line and not line.read()
# The status file is empty - should not have happened,
# but somehow did.
file.close()
return
assert(line == magicline) assert(line == magicline)
for line in file.xreadlines(): for line in file.xreadlines():
line = line.strip() line = line.strip()