From 46636ea52c46278bfe744129900ddafcb60d34a2 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Fri, 24 Apr 2015 11:39:17 -0700 Subject: [PATCH] audit: Guard against a few nil pointer cases --- audit/hashstructure.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/audit/hashstructure.go b/audit/hashstructure.go index 0c62e5722..3de3aea01 100644 --- a/audit/hashstructure.go +++ b/audit/hashstructure.go @@ -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