From 2d88f041d77cefbf679c2bbd293d1e38c01e3cd5 Mon Sep 17 00:00:00 2001 From: Domenico Di Ruocco Date: Tue, 20 Aug 2024 13:58:41 +0200 Subject: [PATCH] fix: check that channel policy exists OTT-6334 --- awsmt/data_source_channel.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/awsmt/data_source_channel.go b/awsmt/data_source_channel.go index 6e783b1..d8ab863 100644 --- a/awsmt/data_source_channel.go +++ b/awsmt/data_source_channel.go @@ -91,8 +91,7 @@ func (d *dataSourceChannel) Configure(_ context.Context, req datasource.Configur func (d *dataSourceChannel) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { var data channelModel - diags := req.Config.Get(ctx, &data) - resp.Diagnostics.Append(diags...) + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return } @@ -114,7 +113,7 @@ func (d *dataSourceChannel) Read(ctx context.Context, req datasource.ReadRequest return } - if policy.Policy != nil { + if policy != nil && policy.Policy != nil { data.Policy = jsontypes.NewNormalizedPointerValue(policy.Policy) }