mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-21 20:41:29 +00:00
Prevent NPE when MMS's FROM PduHeader is missing
Fixes #1448 // FREEBIE
This commit is contained in:
parent
9ffd84ce05
commit
242dbef54e
@ -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) {
|
if (retrieved.getGroupId() != null) {
|
||||||
Recipients groupRecipients = RecipientFactory.getRecipientsFromString(context, retrieved.getGroupId(), true);
|
Recipients groupRecipients = RecipientFactory.getRecipientsFromString(context, retrieved.getGroupId(), true);
|
||||||
return DatabaseFactory.getThreadDatabase(context).getThreadIdFor(groupRecipients);
|
return DatabaseFactory.getThreadDatabase(context).getThreadIdFor(groupRecipients);
|
||||||
@ -253,6 +253,10 @@ public class MmsDatabase extends Database implements MmsSmsColumns {
|
|||||||
EncodedStringValue[] encodedCcList = headers.getEncodedStringValues(PduHeaders.CC);
|
EncodedStringValue[] encodedCcList = headers.getEncodedStringValues(PduHeaders.CC);
|
||||||
EncodedStringValue[] encodedToList = headers.getEncodedStringValues(PduHeaders.TO);
|
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));
|
group.add(new String(encodedFrom.getTextString(), CharacterSets.MIMENAME_ISO_8859_1));
|
||||||
|
|
||||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user