Prevent NPE when MMS's FROM PduHeader is missing

Fixes #1448
// FREEBIE
This commit is contained in:
Jake McGinty 2015-02-15 21:53:59 -08:00
parent 9ffd84ce05
commit 242dbef54e
1 changed files with 5 additions and 1 deletions

View File

@ -239,7 +239,7 @@ public class MmsDatabase extends Database implements MmsSmsColumns {
}
}
private long getThreadIdFor(IncomingMediaMessage retrieved) throws RecipientFormattingException {
private long getThreadIdFor(IncomingMediaMessage retrieved) throws RecipientFormattingException, MmsException {
if (retrieved.getGroupId() != null) {
Recipients groupRecipients = RecipientFactory.getRecipientsFromString(context, retrieved.getGroupId(), true);
return DatabaseFactory.getThreadDatabase(context).getThreadIdFor(groupRecipients);
@ -253,6 +253,10 @@ public class MmsDatabase extends Database implements MmsSmsColumns {
EncodedStringValue[] encodedCcList = headers.getEncodedStringValues(PduHeaders.CC);
EncodedStringValue[] encodedToList = headers.getEncodedStringValues(PduHeaders.TO);
if (encodedFrom == null) {
throw new MmsException("FROM value in PduHeaders did not exist.");
}
group.add(new String(encodedFrom.getTextString(), CharacterSets.MIMENAME_ISO_8859_1));
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);