From 8277e4e102ec3b9cdacda4fda22d37497171a294 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Sun, 15 Feb 2015 23:28:52 -0800 Subject: [PATCH] Fix NPE when InetAddress.getByName() is null Resolves #2189 // FREEBIE --- src/org/thoughtcrime/securesms/mms/MmsConnection.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/org/thoughtcrime/securesms/mms/MmsConnection.java b/src/org/thoughtcrime/securesms/mms/MmsConnection.java index 43ae633629..db13f061b7 100644 --- a/src/org/thoughtcrime/securesms/mms/MmsConnection.java +++ b/src/org/thoughtcrime/securesms/mms/MmsConnection.java @@ -88,6 +88,11 @@ public abstract class MmsConnection { Log.w(TAG, "returning vacuous success since MMS radio is not in use"); return true; } + + if (inetAddress == null) { + throw new IOException("Unable to lookup host: InetAddress.getByName() returned null."); + } + byte[] ipAddressBytes = inetAddress.getAddress(); if (ipAddressBytes == null || ipAddressBytes.length != 4) { Log.w(TAG, "returning vacuous success since android.net package doesn't support IPv6");