diff --git a/client/serverlist.go b/client/serverlist.go index fc71b4b..3eaf0f9 100644 --- a/client/serverlist.go +++ b/client/serverlist.go @@ -28,6 +28,9 @@ func (sl *ServerList) FilterByIdxs(MessageServerIdxs []int) (filtered *ServerLis // GetServerByIdx returns a server from it's index func (sl *ServerList) GetServerByIdx(idx int) (server *Server, err error) { + if idx > len(sl.Servers)-1 { + return nil, errors.New("requested server out of range of defined message servers") + } return &sl.Servers[idx], nil }