From fe02b3f8d38d02757a3fc520734f83581802d16c Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Tue, 16 Jan 2018 11:32:51 -0800 Subject: [PATCH] Catch exception from misconfigured MMSC Fixes #7339 --- .../securesms/mms/IncomingLegacyMmsConnection.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/mms/IncomingLegacyMmsConnection.java b/src/org/thoughtcrime/securesms/mms/IncomingLegacyMmsConnection.java index 0eb7bc055a..b184ce360e 100644 --- a/src/org/thoughtcrime/securesms/mms/IncomingLegacyMmsConnection.java +++ b/src/org/thoughtcrime/securesms/mms/IncomingLegacyMmsConnection.java @@ -48,14 +48,24 @@ public class IncomingLegacyMmsConnection extends LegacyMmsConnection implements } private HttpUriRequest constructRequest(Apn contentApn, boolean useProxy) throws IOException { - HttpGetHC4 request = new HttpGetHC4(contentApn.getMmsc()); + HttpGetHC4 request; + + try { + request = new HttpGetHC4(contentApn.getMmsc()); + } catch (IllegalArgumentException e) { + // #7339 + throw new IOException(e); + } + for (Header header : getBaseHeaders()) { request.addHeader(header); } + if (useProxy) { HttpHost proxy = new HttpHost(contentApn.getProxy(), contentApn.getPort()); request.setConfig(RequestConfig.custom().setProxy(proxy).build()); } + return request; }