libsignal-protocol: Be resilient to missing open session

This commit is contained in:
Scott Nonnenberg 2019-04-08 09:44:08 -07:00
parent eae7660074
commit 494806b314

View file

@ -36185,7 +36185,8 @@ SessionCipher.prototype = {
var errors = [];
return this.decryptWithSessionList(buffer, record.getSessions(), errors).then(function(result) {
return this.getRecord(address).then(function(record) {
if (result.session.indexInfo.baseKey !== record.getOpenSession().indexInfo.baseKey) {
var openSession = record.getOpenSession();
if (!openSession || result.session.indexInfo.baseKey !== openSession.indexInfo.baseKey) {
record.archiveCurrentState();
record.promoteState(result.session);
}