fix ParseUUID. Return error for invalid UUID strings
This commit is contained in:
parent
ef90e5d337
commit
5bedd1dccc
1 changed files with 2 additions and 2 deletions
4
uuid.go
4
uuid.go
|
@ -115,12 +115,12 @@ func ParseUUID(s string) (uuid UUID, err error) {
|
|||
uuid[3-uuidIndex/8] |= uint32(nibble) << (4 * (7 - uuidIndex%8))
|
||||
uuidIndex++
|
||||
}
|
||||
if uuidIndex != 31 {
|
||||
if uuidIndex != 32 {
|
||||
// The UUID doesn't have exactly 32 nibbles. Perhaps a 16-bit or 32-bit
|
||||
// UUID?
|
||||
err = errInvalidUUID
|
||||
}
|
||||
return uuid, nil
|
||||
return
|
||||
}
|
||||
|
||||
// String returns a human-readable version of this UUID, such as
|
||||
|
|
Loading…
Reference in a new issue