diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-03-19 15:19:44 +0200 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-03-19 15:19:44 +0200 |
commit | 160e8ff83642272c744f17e68560eb9b23dc9842 (patch) | |
tree | 7a0c53a987be4b1a99c654b0a3045084f331325a /ui | |
parent | 43127dad0f0c190b0ac93e8f54ff4f16eec9c28c (diff) |
Don't panic if room list is empty
Diffstat (limited to 'ui')
-rw-r--r-- | ui/view-main.go | 3 |
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) |