From b10d7a72cb96df2d563d90ab1811e24aa2fa84ab Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 26 Nov 2013 16:46:58 -0200 Subject: Fix fetch iteration on empty folder --- mail/changes/bug_fix-iteration-empty-mailbox | 1 + mail/src/leap/mail/imap/server.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 mail/changes/bug_fix-iteration-empty-mailbox diff --git a/mail/changes/bug_fix-iteration-empty-mailbox b/mail/changes/bug_fix-iteration-empty-mailbox new file mode 100644 index 0000000..11dd770 --- /dev/null +++ b/mail/changes/bug_fix-iteration-empty-mailbox @@ -0,0 +1 @@ + o Allow to iterate in an empty mailbox during fetch. Closes: #4603 diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py index bb2830d..abe1dfa 100644 --- a/mail/src/leap/mail/imap/server.py +++ b/mail/src/leap/mail/imap/server.py @@ -1512,7 +1512,10 @@ class SoledadMailbox(WithMsgFields): except TypeError: # looks like we cannot iterate last = self.messages.get_last() - uid_last = last.getUID() + if last is None: + uid_last = 1 + else: + uid_last = last.getUID() messages.last = uid_last # for sequence numbers (uid = 0) -- cgit v1.2.3