Merge pull request #5206 from matrix-org/t3chguy/fix/15170

Fix Bridges tab crashing when the room does not have bridges
This commit is contained in:
Michael Telatynski 2020-09-14 17:09:46 +01:00 committed by GitHub
commit ab91ce4b2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,9 +46,10 @@ export default class BridgeSettingsTab extends React.Component<IProps> {
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() {