IMAP.cachemessagelist(): Protect against empty folders
When invoked with FETCH 1:* (UID), imaplib returns [None] for empty folders. We need to protect against this case and simply 'continue' here. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
ff9b941f42
commit
0906d0db70
@ -181,8 +181,10 @@ class IMAPFolder(BaseFolder):
|
|||||||
finally:
|
finally:
|
||||||
self.imapserver.releaseconnection(imapobj)
|
self.imapserver.releaseconnection(imapobj)
|
||||||
for messagestr in response:
|
for messagestr in response:
|
||||||
# looks like: '1 (FLAGS (\\Seen Old) UID 4807)'
|
# looks like: '1 (FLAGS (\\Seen Old) UID 4807)' or None if no msg
|
||||||
# Discard initial message number.
|
# Discard initial message number.
|
||||||
|
if messagestr == None:
|
||||||
|
continue
|
||||||
messagestr = messagestr.split(' ', 1)[1]
|
messagestr = messagestr.split(' ', 1)[1]
|
||||||
options = imaputil.flags2hash(messagestr)
|
options = imaputil.flags2hash(messagestr)
|
||||||
if not options.has_key('UID'):
|
if not options.has_key('UID'):
|
||||||
|
Loading…
Reference in New Issue
Block a user