Check for empty addresses

pull/194/head
M66B 4 years ago
parent d6824bdfcd
commit c08f36f21c

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

Loading…
Cancel
Save