diff --git a/candidate_base.go b/candidate_base.go index 230bde8..7703e71 100644 --- a/candidate_base.go +++ b/candidate_base.go @@ -424,11 +424,11 @@ func (c *candidateBase) Marshal() string { // UnmarshalCandidate creates a Candidate from its string representation func UnmarshalCandidate(raw string) (Candidate, error) { split := strings.Fields(raw) - switch { // Foundation not specified: not RFC 8445 compliant but seen in the wild - case len(split) == 7 && raw[0] == ' ': + if len(raw) != 0 && raw[0] == ' ' { split = append([]string{" "}, split...) - case len(split) < 8: + } + if len(split) < 8 { return nil, fmt.Errorf("%w (%d)", errAttributeTooShortICECandidate, len(split)) }