From 0045f1cb3732dc3b063daf6e2376b2f88a5cb995 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Wed, 29 Aug 2012 12:11:13 -0700 Subject: Unable to receive MMS on Mako Bug 7077996 Restore a null check that was in the original code and fix sending messages to myself. Change-Id: I0e1e9211a3e00deb264ebc724e6fed849ee77f39 --- src/java/com/google/android/mms/pdu/PduPersister.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/java/com/google/android/mms/pdu/PduPersister.java b/src/java/com/google/android/mms/pdu/PduPersister.java index 6568e0a..8dbc90c 100644 --- a/src/java/com/google/android/mms/pdu/PduPersister.java +++ b/src/java/com/google/android/mms/pdu/PduPersister.java @@ -1320,11 +1320,11 @@ public class PduPersister { // composed of all the recipients. This includes the person who sent the // message or the FROM field in addition to the other people the message // was addressed to or the TO field. - loadRecipients(PduHeaders.FROM, recipients, addressMap); - loadRecipients(PduHeaders.TO, recipients, addressMap); + loadRecipients(PduHeaders.FROM, recipients, addressMap, false); + loadRecipients(PduHeaders.TO, recipients, addressMap, true); break; case PduHeaders.MESSAGE_TYPE_SEND_REQ: - loadRecipients(PduHeaders.TO, recipients, addressMap); + loadRecipients(PduHeaders.TO, recipients, addressMap, false); break; } @@ -1397,11 +1397,15 @@ public class PduPersister { * @param addressType can be PduHeaders.FROM or PduHeaders.TO * @param recipients a HashSet that is loaded with the recipients from the FROM or TO headers * @param addressMap a HashMap of the addresses from the ADDRESS_FIELDS header + * @param excludeMyNumber if true, the number of this phone will be excluded from recipients */ private void loadRecipients(int addressType, HashSet recipients, - HashMap addressMap) { + HashMap addressMap, boolean excludeMyNumber) { EncodedStringValue[] array = addressMap.get(addressType); - String myNumber = mTelephonyManager.getLine1Number(); + if (array == null) { + return; + } + String myNumber = excludeMyNumber ? mTelephonyManager.getLine1Number() : null; for (EncodedStringValue v : array) { if (v != null) { String number = v.getString(); -- cgit v1.2.3