Don't panic if room list is empty
This commit is contained in:
parent
43127dad0f
commit
160e8ff836
@ -209,6 +209,9 @@ func (view *MainView) SwitchRoom(roomIndex int) {
|
|||||||
if roomIndex < 0 {
|
if roomIndex < 0 {
|
||||||
roomIndex = len(view.roomIDs) - 1
|
roomIndex = len(view.roomIDs) - 1
|
||||||
}
|
}
|
||||||
|
if len(view.roomIDs) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
view.currentRoomIndex = roomIndex % len(view.roomIDs)
|
view.currentRoomIndex = roomIndex % len(view.roomIDs)
|
||||||
view.roomView.SwitchToPage(view.CurrentRoomID())
|
view.roomView.SwitchToPage(view.CurrentRoomID())
|
||||||
view.roomList.SetCurrentItem(roomIndex)
|
view.roomList.SetCurrentItem(roomIndex)
|
||||||
|
Loading…
Reference in New Issue
Block a user