From dbd8a4083cc379a00bacfccbc8a3c2dc0ef42d71 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Fri, 30 Jan 2015 15:15:10 -1000 Subject: [PATCH] Fix NPE when encrypted MMS has bad base64 encoding // FREEBIE --- src/org/thoughtcrime/securesms/crypto/MmsCipher.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/org/thoughtcrime/securesms/crypto/MmsCipher.java b/src/org/thoughtcrime/securesms/crypto/MmsCipher.java index 29832a522d..3dcce58638 100644 --- a/src/org/thoughtcrime/securesms/crypto/MmsCipher.java +++ b/src/org/thoughtcrime/securesms/crypto/MmsCipher.java @@ -61,6 +61,10 @@ public class MmsCipher { byte[] decodedCiphertext = textTransport.getDecodedMessage(ciphertext.get()); byte[] plaintext; + if (decodedCiphertext == null) { + throw new InvalidMessageException("failed to decode ciphertext"); + } + try { plaintext = sessionCipher.decrypt(new WhisperMessage(decodedCiphertext)); } catch (InvalidMessageException e) {