aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-03-19 15:19:44 +0200
committerTulir Asokan <tulir@maunium.net>2018-03-19 15:19:44 +0200
commit160e8ff83642272c744f17e68560eb9b23dc9842 (patch)
tree7a0c53a987be4b1a99c654b0a3045084f331325a /ui
parent43127dad0f0c190b0ac93e8f54ff4f16eec9c28c (diff)
Don't panic if room list is empty
Diffstat (limited to 'ui')
-rw-r--r--ui/view-main.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/ui/view-main.go b/ui/view-main.go
index c2cd30f..a2848e8 100644
--- a/ui/view-main.go
+++ b/ui/view-main.go
@@ -209,6 +209,9 @@ func (view *MainView) SwitchRoom(roomIndex int) {
if roomIndex < 0 {
roomIndex = len(view.roomIDs) - 1
}
+ if len(view.roomIDs) == 0 {
+ return
+ }
view.currentRoomIndex = roomIndex % len(view.roomIDs)
view.roomView.SwitchToPage(view.CurrentRoomID())
view.roomList.SetCurrentItem(roomIndex)