diff --git a/client/identity.go b/client/identity.go index cd2cad9..4c04dc9 100644 --- a/client/identity.go +++ b/client/identity.go @@ -42,7 +42,12 @@ func (id *Identity) InvitePeer(MyName string, ContactName string, MessageServerI peer.Name = ContactName peer.InvitationId = uuid.New().String() if id.MessageServers.Servers == nil { - return nil, errors.New("no servers defined in your identity") + return nil, errors.New("no message servers defined in your identity") + } + for _, i := range MessageServerIdxs { + if i > len(id.MessageServers.Servers)-1 { + return nil, errors.New("requested server out of range of defined message servers") + } } for _, i := range MessageServerIdxs { srv := id.MessageServers.Servers[i].ServerData