diff --git a/src/org/thoughtcrime/securesms/mms/MmsCommunication.java b/src/org/thoughtcrime/securesms/mms/MmsCommunication.java index f1a35e18c..da0076cb0 100644 --- a/src/org/thoughtcrime/securesms/mms/MmsCommunication.java +++ b/src/org/thoughtcrime/securesms/mms/MmsCommunication.java @@ -157,6 +157,9 @@ public class MmsCommunication { if (entity == null || entity.getContentLength() == 0) throw new IOException("Null response"); + if (entity.getContentLength() < 0) + throw new IOException("Unknown content length!"); + byte[] responseBytes = new byte[(int)entity.getContentLength()]; DataInputStream dataInputStream = new DataInputStream(entity.getContent()); dataInputStream.readFully(responseBytes);