Fixed nil check for token (#6179)

I can only assume we want to check for the retrieved `updatedToken` to not be
nil, before accessing it below.

`token` can't possibly be nil at this point, as we accessed `token.AccessorID`
just before.
This commit is contained in:
Christian Muehlhaeuser 2019-07-19 13:48:11 +02:00 committed by Matt Keeler
parent 45e443f7a3
commit d1426767f6
1 changed files with 1 additions and 1 deletions

View File

@ -602,7 +602,7 @@ func (a *ACL) tokenSetInternal(args *structs.ACLTokenSetRequest, reply *structs.
} }
// Don't check expiration times here as it doesn't really matter. // Don't check expiration times here as it doesn't really matter.
if _, updatedToken, err := a.srv.fsm.State().ACLTokenGetByAccessor(nil, token.AccessorID); err == nil && token != nil { if _, updatedToken, err := a.srv.fsm.State().ACLTokenGetByAccessor(nil, token.AccessorID); err == nil && updatedToken != nil {
*reply = *updatedToken *reply = *updatedToken
} else { } else {
return fmt.Errorf("Failed to retrieve the token after insertion") return fmt.Errorf("Failed to retrieve the token after insertion")