Skip to content

Commit

Permalink
fix(kubernetes): Nil pointer deference in subset diff. (grafana#36)
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
  • Loading branch information
tomwilkie authored and sh0rez committed Aug 12, 2019
1 parent 7602a19 commit f53c2b5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg/kubernetes/subsetdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (k Kubectl) SubsetDiff(y string) (*string, error) {
return nil, errors.Wrap(lastErr, "calculating subset")
}

var diffs *string
var diffs string
for _, d := range docs {
diffStr, err := diff(d.name, d.live, d.merged)
if err != nil {
Expand All @@ -67,13 +67,10 @@ func (k Kubectl) SubsetDiff(y string) (*string, error) {
if diffStr != "" {
diffStr += "\n"
}
if diffs == nil {
*diffs = ""
}
*diffs += diffStr
diffs += diffStr
}

return diffs, nil
return &diffs, nil
}

func subsetDiff(k Kubectl, rawShould map[interface{}]interface{}, r chan difference, e chan error) {
Expand Down

0 comments on commit f53c2b5

Please sign in to comment.