diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 9e59e8ea5c..fae2b831d5 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -570,7 +570,10 @@ module.exports = React.createClass({ const allRooms = RoomListSorter.mostRecentActivityFirst( MatrixClientPeg.get().getRooms(), ); - if (allRooms.length === 0) { + // If there are 0 rooms or 1 room, view the home page because otherwise + // if there are 0, we end up trying to index into an empty array, and + // if there is 1, we end up viewing the same room. + if (allRooms.length < 2) { dis.dispatch({ action: 'view_home_page', });