Fix out of range

This commit is contained in:
Rekby 2016-04-10 16:06:49 +03:00
parent 232fbbef08
commit ec18c6e42f

View file

@ -101,7 +101,9 @@ func (j *jws) Nonce() (string, error) {
if err != nil { if err != nil {
return nonce, err return nonce, err
} }
return "", errors.New("Can't get nonce") if len(j.nonces) == 0 {
return "", errors.New("Can't get nonce")
}
} }
nonce, j.nonces = j.nonces[len(j.nonces)-1], j.nonces[:len(j.nonces)-1] nonce, j.nonces = j.nonces[len(j.nonces)-1], j.nonces[:len(j.nonces)-1]