From b8551f00b257ab47335fa8f1eb15af633773cbc1 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 5 Apr 2019 15:25:59 -0600 Subject: [PATCH] Prevent the permalink creator from causing cascading failure --- src/matrix-to.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/matrix-to.js b/src/matrix-to.js index 7223f2e33d..bb7ddfbd94 100644 --- a/src/matrix-to.js +++ b/src/matrix-to.js @@ -83,6 +83,14 @@ export class RoomPermalinkCreator { } load() { + if (!this._room || !this._room.currentState) { + // Under rare and unknown circumstances it is possible to have a room with no + // currentState, at least potentially at the early stages of joining a room. + // To avoid breaking everything, we'll just warn rather than throw as well as + // not bother updating the various aspects of the share link. + console.warn("Tried to load a permalink creator with no room state"); + return; + } this._updateAllowedServers(); this._updateHighestPlUser(); this._updatePopulationMap();