diff options
l--------- | tview | 1 | ||||
-rw-r--r-- | ui/view-main.go | 3 |
2 files changed, 4 insertions, 0 deletions
@@ -0,0 +1 @@ +../tview
\ No newline at end of file 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) |