1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-31 20:25:38 +00:00

Check for empty addresses

This commit is contained in:
M66B 2021-02-03 14:02:05 +01:00
parent d6824bdfcd
commit c08f36f21c

View file

@ -1214,11 +1214,15 @@ public class MessageHelper {
header = header.replaceAll("\\?=[\\r\\n\\t ]+=\\?", "\\?==\\?");
Address[] addresses = InternetAddress.parseHeader(header, false);
List<Address> result = new ArrayList<>();
for (Address address : addresses) {
InternetAddress iaddress = (InternetAddress) address;
String email = iaddress.getAddress();
String personal = iaddress.getPersonal();
if (TextUtils.isEmpty(email) && TextUtils.isEmpty(personal))
continue;
email = decodeMime(email);
if (!Helper.isSingleScript(email))
email = punyCode(email);
@ -1232,9 +1236,11 @@ public class MessageHelper {
Log.w(ex);
}
}
result.add(address);
}
return addresses;
return (result.size() == 0 ? null : result.toArray(new Address[0]));
}
Address[] getReturnPath() throws MessagingException {