1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-17 17:42:41 +03:00

More explicit reference checking

This commit is contained in:
Simon Merrick
2020-12-02 12:34:43 +13:00
parent e92ac67152
commit cf8c98e076

View File

@@ -130,14 +130,15 @@ export class RoomPermalinkCreator {
} }
forRoom() { forRoom() {
try { if (this._room) {
// Prefer to use canonical alias for permalink if possible // Prefer to use canonical alias for permalink if possible
const alias = this._room.getCanonicalAlias(); const alias = this._room.getCanonicalAlias();
if (alias) {
return getPermalinkConstructor().forRoom(alias, this._serverCandidates); return getPermalinkConstructor().forRoom(alias, this._serverCandidates);
} catch (error) {
return getPermalinkConstructor().forRoom(this._roomId, this._serverCandidates);
} }
} }
return getPermalinkConstructor().forRoom(this._roomId, this._serverCandidates);
}
onRoomState(event) { onRoomState(event) {
switch (event.getType()) { switch (event.getType()) {