From a8a04d403657d6d80fff8ffd99ba461b7831d048 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 28 Oct 2021 12:00:22 +0530 Subject: [PATCH] Enclose in try..finally Signed-off-by: RMidhunSuresh --- src/domain/session/room/timeline/TimelineViewModel.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/domain/session/room/timeline/TimelineViewModel.js b/src/domain/session/room/timeline/TimelineViewModel.js index 31be88ac..32a92cee 100644 --- a/src/domain/session/room/timeline/TimelineViewModel.js +++ b/src/domain/session/room/timeline/TimelineViewModel.js @@ -70,8 +70,13 @@ export class TimelineViewModel extends ViewModel { onReset: (idx, tile) => checkForUpdate(idx, tile) }; this.tiles.subscribe(subscription); - const gapResult = await gapPromise; - this.tiles.unsubscribe(subscription); + let gapResult; + try { + gapResult = await gapPromise; + } + finally { + this.tiles.unsubscribe(subscription); + } if (!gapResult) { return; }