Skip to content

Commit

Permalink
Merge pull request #37 from jtopjian/fix-proxyrequests-nil
Browse files Browse the repository at this point in the history
Fix nil pointer bug in sensu_check.proxy_requests
  • Loading branch information
jtopjian authored Jul 13, 2020
2 parents c7b3cfd + 09a249e commit 8794053
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions sensu/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,13 +590,15 @@ func expandCheckProxyRequests(v []interface{}) types.ProxyRequests {

func flattenCheckProxyRequests(v *types.ProxyRequests) []map[string]interface{} {
var proxyRequests []map[string]interface{}
pr := make(map[string]interface{})

if len(v.EntityAttributes) > 0 {
pr["entity_attributes"] = v.EntityAttributes
pr["splay"] = v.Splay
pr["splay_coverage"] = v.SplayCoverage
proxyRequests = append(proxyRequests, pr)
if v != nil {
if len(v.EntityAttributes) > 0 {
pr := make(map[string]interface{})
pr["entity_attributes"] = v.EntityAttributes
pr["splay"] = v.Splay
pr["splay_coverage"] = v.SplayCoverage
proxyRequests = append(proxyRequests, pr)
}
}

return proxyRequests
Expand Down

0 comments on commit 8794053

Please sign in to comment.