1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Add a catch so the error doesn't propagate to later decryptions

This commit is contained in:
David Baker
2020-04-17 18:03:15 +01:00
parent 83879fa945
commit 83b33d9d7a

View File

@@ -272,10 +272,12 @@ OlmDecryption.prototype._decryptMessage = async function(
// not a prekey message: we can safely just try & decrypt it
return this._reallyDecryptMessage(theirDeviceIdentityKey, message);
} else {
this._olmDevice._olmPrekeyPromise = this._olmDevice._olmPrekeyPromise.then(() => {
const myPromise = this._olmDevice._olmPrekeyPromise.then(() => {
return this._reallyDecryptMessage(theirDeviceIdentityKey, message);
});
return await this._olmDevice._olmPrekeyPromise;
// we want the error, but don't propagate it to the next decryption
this._olmDevice._olmPrekeyPromise = myPromise.catch(() => {});
return await myPromise;
}
};