From 3e94c7039e7828a8315a4e7c3079d99f24d66082 Mon Sep 17 00:00:00 2001 From: Ezequiel Leanes Date: Wed, 24 Jan 2024 12:30:23 -0300 Subject: [PATCH] fix: add catch to listBatchDecryptedMessages method (#161) * fix: add catch to listBatchDecryptedMessages method * add the fix to the decoded messages as well * Revert "add the fix to the decoded messages as well" This reverts commit d6eb8bdc964a7ea7a45dc688b19eda465a25e1fa. --------- Co-authored-by: Naomi Plasterer --- .../main/java/org/xmtp/android/library/Conversations.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/org/xmtp/android/library/Conversations.kt b/library/src/main/java/org/xmtp/android/library/Conversations.kt index 71edc7b37..46fe1582b 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversations.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversations.kt @@ -358,8 +358,13 @@ data class Conversations( Log.d(TAG, "discarding message, unknown conversation $envelope") return@mapNotNull null } - val msg = conversation.decrypt(envelope) - msg + try { + val msg = conversation.decrypt(envelope) + msg + } catch (e: Exception) { + Log.e(TAG, "Error decrypting message: $envelope", e) + null + } } }, )