1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

. Added defensive code against empty self BCC address

This fixed issues 639 & 646
This commit is contained in:
Bao-Long Nguyen-Trong 2009-09-25 17:02:50 +00:00
parent f3312eb064
commit c2ca739293
2 changed files with 14 additions and 4 deletions

View File

@ -516,8 +516,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
} }
if (!ACTION_EDIT_DRAFT.equals(action)) { if (!ACTION_EDIT_DRAFT.equals(action)) {
String bccAddress = mAccount.getAlwaysBcc();
if (bccAddress!=null
&& !"".equals(bccAddress)) {
addAddress(mBccView, new Address(mAccount.getAlwaysBcc(), "")); addAddress(mBccView, new Address(mAccount.getAlwaysBcc(), ""));
} }
}
Log.d(Email.LOG_TAG, "action = " + action + ", mAccount = " + mAccount + ", mFolder = " + mFolder + ", mSourceMessageUid = " + mSourceMessageUid); Log.d(Email.LOG_TAG, "action = " + action + ", mAccount = " + mAccount + ", mFolder = " + mFolder + ", mSourceMessageUid = " + mSourceMessageUid);
if ((ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) && mAccount != null && mFolder != null && mSourceMessageUid != null) { if ((ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) && mAccount != null && mFolder != null && mSourceMessageUid != null) {

View File

@ -70,12 +70,17 @@ public class Address {
*/ */
public static Address[] parseUnencoded(String addressList) { public static Address[] parseUnencoded(String addressList) {
List<Address> addresses = new ArrayList<Address>(); List<Address> addresses = new ArrayList<Address>();
if (addressList!=null) { if (addressList!=null
&& !"".equals(addressList)) {
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressList); Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressList);
for (Rfc822Token token : tokens) { for (Rfc822Token token : tokens) {
String address = token.getAddress();
if (address!=null
&& !"".equals(address)) {
addresses.add(new Address(token.getAddress(), token.getName())); addresses.add(new Address(token.getAddress(), token.getName()));
} }
} }
}
return addresses.toArray(new Address[0]); return addresses.toArray(new Address[0]);
} }
@ -88,7 +93,8 @@ public class Address {
*/ */
public static Address[] parse(String addressList) { public static Address[] parse(String addressList) {
ArrayList<Address> addresses = new ArrayList<Address>(); ArrayList<Address> addresses = new ArrayList<Address>();
if (addressList == null) { if (addressList == null
&& !"".equals(addressList)) {
return new Address[] {}; return new Address[] {};
} }
try { try {