audit: Guard against a few nil pointer cases

This commit is contained in:
Armon Dadgar
2015-04-24 11:39:17 -07:00
committed by Mitchell Hashimoto
parent cee1d20015
commit 139a8db461

View File

@@ -22,6 +22,9 @@ func Hash(raw interface{}) error {
switch s := raw.(type) {
case *logical.Auth:
if s == nil {
return nil
}
if s.ClientToken != "" {
token, err := fn(s.ClientToken)
if err != nil {
@@ -31,6 +34,9 @@ func Hash(raw interface{}) error {
s.ClientToken = token
}
case *logical.Request:
if s == nil {
return nil
}
if s.Auth != nil {
if err := Hash(s.Auth); err != nil {
return err
@@ -44,6 +50,9 @@ func Hash(raw interface{}) error {
s.Data = data.(map[string]interface{})
case *logical.Response:
if s == nil {
return nil
}
if s.Auth != nil {
if err := Hash(s.Auth); err != nil {
return err