diff --git a/model/sharing/member.go b/model/sharing/member.go index 2f82153d473..56b867b0ecd 100644 --- a/model/sharing/member.go +++ b/model/sharing/member.go @@ -461,6 +461,9 @@ func (s *Sharing) DelegateDiscovery(inst *instance.Instance, state, cozyURL stri v.Add("state", state) v.Add("url", cozyURL) body := []byte(v.Encode()) + if len(s.Credentials) == 0 { + return "", ErrInvalidSharing + } c := &s.Credentials[0] opts := &request.Options{ Method: http.MethodPost,