Fix for IllegalArgumentException with null URL host.

pull/1/head
Moxie Marlinspike 11 years ago
parent ff41c6763d
commit 43214a854c

@ -28,6 +28,7 @@ import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.thoughtcrime.securesms.service.MmscProcessor;
import org.thoughtcrime.securesms.util.Util;
import ws.com.google.android.mms.pdu.PduParser;
import ws.com.google.android.mms.pdu.SendConf;
@ -45,6 +46,10 @@ public class MmsSendHelper extends MmsCommunication {
Log.w("MmsSender", "Sending MMS1 of length: " + (mms != null ? mms.length : "null"));
client = constructHttpClient(context, parameters);
URI targetUrl = new URI(parameters.getMmsc());
if (Util.isEmpty(targetUrl.getHost()))
throw new IOException("Invalid target host: " + targetUrl.getHost() + " , " + targetUrl);
HttpHost target = new HttpHost(targetUrl.getHost(), targetUrl.getPort(), HttpHost.DEFAULT_SCHEME_NAME);
HttpPost request = new HttpPost(parameters.getMmsc());
ByteArrayEntity entity = new ByteArrayEntity(mms);

Loading…
Cancel
Save