Don't panic if room list is empty

This commit is contained in:
Tulir Asokan 2018-03-19 15:19:44 +02:00
parent 43127dad0f
commit 160e8ff836
2 changed files with 4 additions and 0 deletions

1
tview Symbolic link
View File

@ -0,0 +1 @@
../tview

View File

@ -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)