Skip to content

Commit d2339f9

Browse files
Dylanactions-user
authored andcommitted
Handle nil cleanup functions (#1512)
Because I don't have an exact version, I can't be 100% sure, but I believe the stack trace in the ticket ENG-320 Is caused by this cleanup function being nil. Either way, it seems like a good thing to do to doublecheck before deferring a function that it is actually set Fixes ENG-320 GitOrigin-RevId: a2e1057bd6d54f2238fbb85cb814255eea4a0fd8
1 parent ca67229 commit d2339f9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/terraform_plan.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ func TerraformPlan(cmd *cobra.Command, args []string) error {
7474
if err != nil {
7575
return err
7676
}
77-
defer cleanup()
77+
if cleanup != nil {
78+
defer cleanup()
79+
}
7880

7981
return TerraformPlanImpl(ctx, cmd, oi, args, planFile)
8082
}

0 commit comments

Comments
 (0)