diff --git a/src/org/thoughtcrime/securesms/crypto/ModernDecryptingPartInputStream.java b/src/org/thoughtcrime/securesms/crypto/ModernDecryptingPartInputStream.java index e96da29dcf..e8c4e02c66 100644 --- a/src/org/thoughtcrime/securesms/crypto/ModernDecryptingPartInputStream.java +++ b/src/org/thoughtcrime/securesms/crypto/ModernDecryptingPartInputStream.java @@ -75,8 +75,9 @@ public class ModernDecryptingPartInputStream { for (;;) { int read = in.read(buffer, offset, buffer.length-offset); - if (read + offset < buffer.length) offset += read; - else return; + if (read == -1) throw new IOException("Prematurely reached end of stream!"); + else if (read + offset < buffer.length) offset += read; + else return; } }