Skip to content

Commit 1d122b0

Browse files
committed
fix(tem): protect read dmarc
1 parent 6759c91 commit 1d122b0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/services/tem/domain.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,13 @@ func ResourceDomainRead(ctx context.Context, d *schema.ResourceData, m interface
242242
_ = d.Set("last_error", domain.LastError) //nolint:staticcheck
243243
_ = d.Set("spf_config", domain.SpfConfig)
244244
_ = d.Set("dkim_config", domain.DkimConfig)
245-
_ = d.Set("dmarc_name", domain.Records.Dmarc.Name)
246-
_ = d.Set("dmarc_config", domain.Records.Dmarc.Value)
245+
if domain.Records != nil && domain.Records.Dmarc != nil {
246+
_ = d.Set("dmarc_name", domain.Records.Dmarc.Name)
247+
_ = d.Set("dmarc_config", domain.Records.Dmarc.Value)
248+
} else {
249+
_ = d.Set("dmarc_name", "")
250+
_ = d.Set("dmarc_config", "")
251+
}
247252
_ = d.Set("smtp_host", tem.SMTPHost)
248253
_ = d.Set("smtp_port_unsecure", tem.SMTPPortUnsecure)
249254
_ = d.Set("smtp_port", tem.SMTPPort)

0 commit comments

Comments
 (0)