From cd5de796b700a3247682b74d9f674df86a2f78cd Mon Sep 17 00:00:00 2001 From: xfakt-pj Date: Thu, 23 Feb 2017 11:01:49 +0100 Subject: [PATCH] check if 'folder' variable is empty before passing it to get_messages_to_local_maildir() --- nopriv.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nopriv.py b/nopriv.py index 57b65ae..6cc4ee9 100755 --- a/nopriv.py +++ b/nopriv.py @@ -854,7 +854,8 @@ def backup_mails_to_html_from_local_maildir(folder): retries = 0 if ssl: try: - get_messages_to_local_maildir(folder, mail) + if folder: + get_messages_to_local_maildir(folder, mail) except imaplib.IMAP4_SSL.abort: if retries < 5: print(("SSL Connection Abort. Trying again (#%i).") % retries) @@ -865,7 +866,8 @@ def backup_mails_to_html_from_local_maildir(folder): print("SSL Connection gave more than 5 errors. Not trying again") else: try: - get_messages_to_local_maildir(folder, mail) + if folder: + get_messages_to_local_maildir(folder, mail) except imaplib.IMAP4.abort: if retries < 5: print(("Connection Abort. Trying again (#%i).") % retries)