mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Null check for cipher text to prevent NPE on decryption
Fixes #1703 Closes #1728 // FREEBIE
This commit is contained in:
parent
530ad7bc86
commit
acc7c4c1c6
@ -24,13 +24,13 @@ import android.util.Pair;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.AsymmetricMasterCipher;
|
||||
import org.thoughtcrime.securesms.crypto.AsymmetricMasterSecret;
|
||||
import org.whispersystems.textsecure.crypto.InvalidMessageException;
|
||||
import org.whispersystems.textsecure.crypto.MasterCipher;
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.database.model.DisplayRecord;
|
||||
import org.thoughtcrime.securesms.sms.IncomingTextMessage;
|
||||
import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
||||
import org.thoughtcrime.securesms.util.LRUCache;
|
||||
import org.whispersystems.textsecure.crypto.InvalidMessageException;
|
||||
import org.whispersystems.textsecure.crypto.MasterCipher;
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.Collections;
|
||||
@ -145,6 +145,10 @@ public class EncryptingSmsDatabase extends SmsDatabase {
|
||||
long type = cursor.getLong(cursor.getColumnIndexOrThrow(SmsDatabase.TYPE));
|
||||
String ciphertext = cursor.getString(cursor.getColumnIndexOrThrow(SmsDatabase.BODY));
|
||||
|
||||
if (ciphertext == null) {
|
||||
return new DisplayRecord.Body("", true);
|
||||
}
|
||||
|
||||
try {
|
||||
if (SmsDatabase.Types.isSymmetricEncryption(type)) {
|
||||
String plaintext = plaintextCache.get(ciphertext);
|
||||
|
Loading…
x
Reference in New Issue
Block a user