aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
l---------tview1
-rw-r--r--ui/view-main.go3
2 files changed, 4 insertions, 0 deletions
diff --git a/tview b/tview
new file mode 120000
index 0000000..83d3467
--- /dev/null
+++ b/tview
@@ -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)