From cf8c98e07665ec8f68846a5524b566d980c22e90 Mon Sep 17 00:00:00 2001 From: Simon Merrick Date: Wed, 2 Dec 2020 12:34:43 +1300 Subject: [PATCH] More explicit reference checking --- src/utils/permalinks/Permalinks.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/permalinks/Permalinks.js b/src/utils/permalinks/Permalinks.js index 2f673e0346..2c38a982d3 100644 --- a/src/utils/permalinks/Permalinks.js +++ b/src/utils/permalinks/Permalinks.js @@ -130,13 +130,14 @@ export class RoomPermalinkCreator { } forRoom() { - try { + if (this._room) { // Prefer to use canonical alias for permalink if possible const alias = this._room.getCanonicalAlias(); - return getPermalinkConstructor().forRoom(alias, this._serverCandidates); - } catch (error) { - return getPermalinkConstructor().forRoom(this._roomId, this._serverCandidates); + if (alias) { + return getPermalinkConstructor().forRoom(alias, this._serverCandidates); + } } + return getPermalinkConstructor().forRoom(this._roomId, this._serverCandidates); } onRoomState(event) {