From 3066d48b3e1cf8bc737f4146a455cf2e80803d8a Mon Sep 17 00:00:00 2001 From: ycc Date: Wed, 30 Nov 2022 21:35:38 +0100 Subject: [PATCH] Identity Messageservers count errors --- client/identity.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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