server.newParticipant() vereinfacht

This commit is contained in:
Jason Streifling 2023-10-18 16:26:04 +02:00
parent 3e9cfb49eb
commit db070776b1

View File

@ -105,14 +105,14 @@ func loginIsCorrect(l string, logins *[]string) bool {
} }
func newParticipant(l string) (*types.Participant, error) { func newParticipant(l string) (*types.Participant, error) {
var err error
p := new(types.Participant) p := new(types.Participant)
idInt, err := strconv.Atoi(strings.Split(l, "-")[0]) p.ID, err = strconv.Atoi(strings.Split(l, "-")[0])
if err != nil { if err != nil {
return nil, fmt.Errorf("newParticipant: strconv.Atoi(idString): %v\n", err) return nil, fmt.Errorf("newParticipant: strconv.Atoi(idString): %v\n", err)
} }
p.ID = int64(idInt)
return p, nil return p, nil
} }