From 901c149e9eadfe7708dd472e018e595810cfafae Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Mon, 15 May 2023 23:01:43 +0530 Subject: [PATCH] Don't get stuck on user input --- src/matrix/verification/SAS/stages/CalculateSASStage.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/matrix/verification/SAS/stages/CalculateSASStage.ts b/src/matrix/verification/SAS/stages/CalculateSASStage.ts index 4a991897..0330c7e3 100644 --- a/src/matrix/verification/SAS/stages/CalculateSASStage.ts +++ b/src/matrix/verification/SAS/stages/CalculateSASStage.ts @@ -75,7 +75,9 @@ export class CalculateSASStage extends BaseSASVerificationStage { const sasBytes = this.generateSASBytes(); this.emoji = generateEmojiSas(Array.from(sasBytes)); this.eventEmitter.emit("EmojiGenerated", this); - await emojiConfirmationPromise; + const cancellationReceived = this.channel.waitForEvent(VerificationEventType.Cancel); + // Don't get stuck on waiting for user input! + await Promise.race([emojiConfirmationPromise, cancellationReceived]); this.setNextStage(new SendMacStage(this.options)); }); }