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.
This commit is contained in:
Rodolfo García Peñas (kix) 2020-11-08 22:07:14 +01:00
parent ca0a2651a3
commit 0fe1caa6a5

View File

@ -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: