From 557669b08e3734bf1e0e6fa871f17d76968af0fb Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 3 Jan 2020 11:12:55 +0000 Subject: [PATCH] Don't crash if a keyshare request is removed ...during the time the dialog is displayed. Fixes https://github.com/vector-im/riot-web/issues/11745 (hopefully) --- src/KeyRequestHandler.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/KeyRequestHandler.js b/src/KeyRequestHandler.js index c3de7988b2..4ee258da53 100644 --- a/src/KeyRequestHandler.js +++ b/src/KeyRequestHandler.js @@ -111,6 +111,12 @@ export default class KeyRequestHandler { this._currentUser = null; this._currentDevice = null; + if (!this._pendingKeyRequests[userId] || !this._pendingKeyRequests[userId][deviceId]) { + // request was removed in the time the dialog was displayed + this._processNextRequest(); + return; + } + if (r) { for (const req of this._pendingKeyRequests[userId][deviceId]) { req.share();