diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index 2e8bb94e4..082f12b35 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -731,11 +731,16 @@ MessageReceiver.prototype.extend({ window.log.info('prekey message from', this.getEnvelopeId(envelope)); promise = captureActiveSession(sessionCipher) .then(async () => { - const buffer = dcodeIO.ByteBuffer.wrap(ciphertext); - await window.libloki.storage.verifyFriendRequestAcceptPreKey( - envelope.source, - buffer - ); + try { + const buffer = dcodeIO.ByteBuffer.wrap(ciphertext); + await window.libloki.storage.verifyFriendRequestAcceptPreKey( + envelope.source, + buffer + ); + } catch (e) { + await this.removeFromCache(envelope); + throw e; + } return this.decryptPreKeyWhisperMessage( ciphertext, sessionCipher,