Don't try to decrypt if message is blank

This commit is contained in:
Vitor Pamplona 2023-05-10 14:02:53 -04:00
parent a62f2e44d0
commit 434c1e9af3

View File

@ -23,12 +23,14 @@ abstract class GeneralListEvent(
fun bookmarkedPeople() = taggedUsers()
fun plainContent(privKey: ByteArray): String? {
if (content.isBlank()) return null
return try {
val sharedSecret = Utils.getSharedSecret(privKey, pubKey.hexToByteArray())
return Utils.decrypt(content, sharedSecret)
} catch (e: Exception) {
Log.w("GeneralList", "Error decrypting the message ${e.message}")
Log.w("GeneralList", "Error decrypting the message ${e.message} for ${dTag()}")
null
}
}