mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Fix NPE in Address.Parse
Found by FindBugs. Also avoid an allocation in the uncommon case.
This commit is contained in:
parent
47a4bd77ad
commit
ad5676ed28
@ -131,10 +131,10 @@ public class Address {
|
|||||||
* @return An array of 0 or more Addresses.
|
* @return An array of 0 or more Addresses.
|
||||||
*/
|
*/
|
||||||
public static Address[] parse(String addressList) {
|
public static Address[] parse(String addressList) {
|
||||||
ArrayList<Address> addresses = new ArrayList<Address>();
|
if (addressList == null || addressList.isEmpty()) {
|
||||||
if ((addressList == null) && !("".equals(addressList))) {
|
|
||||||
return EMPTY_ADDRESS_ARRAY;
|
return EMPTY_ADDRESS_ARRAY;
|
||||||
}
|
}
|
||||||
|
List<Address> addresses = new ArrayList<Address>();
|
||||||
try {
|
try {
|
||||||
MailboxList parsedList = AddressBuilder.parseAddressList(addressList).flatten();
|
MailboxList parsedList = AddressBuilder.parseAddressList(addressList).flatten();
|
||||||
for (int i = 0, count = parsedList.size(); i < count; i++) {
|
for (int i = 0, count = parsedList.size(); i < count; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user