mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-28 10:47:46 +00:00
Fix null-response NPE in outgoing MMS
Fixes #2839 Closes #2840 // FREEBIE
This commit is contained in:
parent
e70298e624
commit
c04b675a1a
@ -20,6 +20,7 @@ import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.http.Header;
|
||||
@ -70,7 +71,7 @@ public class OutgoingLegacyMmsConnection extends LegacyMmsConnection implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendConf send(byte[] pduBytes) throws UndeliverableMessageException {
|
||||
public SendConf send(@NonNull byte[] pduBytes) throws UndeliverableMessageException {
|
||||
try {
|
||||
MmsRadio radio = MmsRadio.getInstance(context);
|
||||
|
||||
|
@ -21,6 +21,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.telephony.SmsManager;
|
||||
import android.util.Log;
|
||||
|
||||
@ -57,7 +58,7 @@ public class OutgoingLollipopMmsConnection extends LollipopMmsConnection impleme
|
||||
|
||||
@Override
|
||||
@TargetApi(VERSION_CODES.LOLLIPOP)
|
||||
public synchronized SendConf send(byte[] pduBytes) throws UndeliverableMessageException {
|
||||
public synchronized SendConf send(@NonNull byte[] pduBytes) throws UndeliverableMessageException {
|
||||
beginTransaction();
|
||||
try {
|
||||
MmsBodyProvider.Pointer pointer = MmsBodyProvider.makeTemporaryPointer(getContext());
|
||||
@ -74,6 +75,10 @@ public class OutgoingLollipopMmsConnection extends LollipopMmsConnection impleme
|
||||
Log.w(TAG, "MMS broadcast received and processed.");
|
||||
pointer.close();
|
||||
|
||||
if (response == null) {
|
||||
throw new UndeliverableMessageException("Null response.");
|
||||
}
|
||||
|
||||
return (SendConf) new PduParser(response).parse();
|
||||
} catch (IOException | TimeoutException e) {
|
||||
throw new UndeliverableMessageException(e);
|
||||
|
@ -1,9 +1,11 @@
|
||||
package org.thoughtcrime.securesms.mms;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.transport.UndeliverableMessageException;
|
||||
|
||||
import ws.com.google.android.mms.pdu.SendConf;
|
||||
|
||||
public interface OutgoingMmsConnection {
|
||||
SendConf send(byte[] pduBytes) throws UndeliverableMessageException;
|
||||
SendConf send(@NonNull byte[] pduBytes) throws UndeliverableMessageException;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user