From 960a38fe4308d2844cdf61e2a936ce505f9d1a14 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 14 Aug 2015 15:44:21 +0100 Subject: [PATCH] Don't try loading -ve room indices --- src/controllers/pages/MatrixChat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/pages/MatrixChat.js b/src/controllers/pages/MatrixChat.js index 09c01374..71c9140c 100644 --- a/src/controllers/pages/MatrixChat.js +++ b/src/controllers/pages/MatrixChat.js @@ -166,7 +166,7 @@ module.exports = { break; } } - roomIndex = (roomIndex + roomIndexDelta) % allRooms.length; + roomIndex = Math.max((roomIndex + roomIndexDelta) % allRooms.length, 0); this.focusComposer = true; this.setState({ currentRoom: allRooms[roomIndex].roomId