From 1f843561cf7121da96e6bd15ba029096a88b85a4 Mon Sep 17 00:00:00 2001 From: Sami Alhaddad Date: Sun, 5 Feb 2023 00:44:00 +0100 Subject: [PATCH] fix(tfstack): null pointer exception once drift is detected --- pkg/tfstack/tfstack.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/tfstack/tfstack.go b/pkg/tfstack/tfstack.go index f273003..12a51df 100644 --- a/pkg/tfstack/tfstack.go +++ b/pkg/tfstack/tfstack.go @@ -183,7 +183,7 @@ func stackExists(name string, stacks []config.Stack) (stack config.Stack, result // driftCalculator returns a detailed number of changes that was detected in the plan func driftCalculator(state *tfjson.Plan) (*DriftSum, error) { - var driftSum *DriftSum + var driftSum DriftSum for _, resource := range state.ResourceChanges { for _, action := range resource.Change.Actions { @@ -203,7 +203,7 @@ func driftCalculator(state *tfjson.Plan) (*DriftSum, error) { driftSum.Drift = true } - return driftSum, nil + return &driftSum, nil } // cleanUpPlanFile removes the plan file after the plan has been reported