From 0fe1caa6a567cd4d7c75a6093cf676a38f07daf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sun, 8 Nov 2020 22:07:14 +0100 Subject: [PATCH] Avoid crash in search if no results I am incluiding this check to avoid crash if the array is empty and we are trying to read the first element. --- offlineimap/folder/IMAP.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 464caa7..f08361b 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -238,7 +238,7 @@ class IMAPFolder(BaseFolder): # Then, I can do the check in the same way than Python 2 # with string comparison: - if ' ' in res_data[0] or res_data[0] == '': + if len(res_data) > 0 and (' ' in res_data[0] or res_data[0] == ''): res_data = res_data[0].split() # Some servers are broken. if 0 in res_data: