From e32cb175cb24b7f43c0f1bc8cf9ae2814b03870b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 14 Sep 2020 15:44:00 +0100 Subject: [PATCH] Fix Bridges tab crashing when the room does not have bridges --- .../views/settings/tabs/room/BridgeSettingsTab.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/views/settings/tabs/room/BridgeSettingsTab.tsx b/src/components/views/settings/tabs/room/BridgeSettingsTab.tsx index 8638105cd9..3c74bd4c1a 100644 --- a/src/components/views/settings/tabs/room/BridgeSettingsTab.tsx +++ b/src/components/views/settings/tabs/room/BridgeSettingsTab.tsx @@ -46,9 +46,10 @@ export default class BridgeSettingsTab extends React.Component { const client = MatrixClientPeg.get(); const roomState = client.getRoom(roomId).currentState; - return [].concat(...BRIDGE_EVENT_TYPES.map((typeName) => - Array.from(roomState.events.get(typeName).values()), - )); + return BRIDGE_EVENT_TYPES.map(typeName => { + const events = roomState.events.get(typeName); + return events ? Array.from(events.values()) : []; + }).flat(1); } render() {