Skip to content

Commit

Permalink
fix: Add missed nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
uanid committed Jan 31, 2024
1 parent 1c1303a commit 2d78e15
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/services/cidrs/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ func (t SpecType) Schema() *schema.Schema {

func (t SpecType) Expand(ctx context.Context, d *schema.ResourceData, out *bluechip_models.CidrSpec) diag.Diagnostics {
attr := d.Get("spec.0").(map[string]any)
out.Ipv4Cidrs = fwflex.ExpandStringSet(attr["ipv4_cidrs"].(*schema.Set))
out.Ipv6Cidrs = fwflex.ExpandStringSet(attr["ipv6_cidrs"].(*schema.Set))

if attr["ipv4_cidrs"] != nil {
out.Ipv4Cidrs = fwflex.ExpandStringSet(attr["ipv4_cidrs"].(*schema.Set))
}

if attr["ipv6_cidrs"] != nil {
out.Ipv6Cidrs = fwflex.ExpandStringSet(attr["ipv6_cidrs"].(*schema.Set))
}
return nil
}

Expand Down

0 comments on commit 2d78e15

Please sign in to comment.