Skip to content

Commit

Permalink
Avoid nil dereference on IP stack DNS.
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Arnold <marnold@redhat.com>
  • Loading branch information
mrnold authored and mnecas committed Jan 9, 2025
1 parent 70bcfae commit f4b0b61
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/controller/provider/container/vsphere/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,10 +685,14 @@ func (v *VmAdapter) Apply(u types.ObjectUpdate) {
for _, ipa := range ipas.GuestStackInfo {
routes := ipa.IpRouteConfig.IpRoute
for _, route := range routes {
var dnsList []string
if ipa.DnsConfig != nil {
dnsList = ipa.DnsConfig.IpAddress
}
if len(route.Gateway.IpAddress) > 0 {
guestIpStackList = append(guestIpStackList, model.GuestIpStack{
Gateway: route.Gateway.IpAddress,
DNS: ipa.DnsConfig.IpAddress,
DNS: dnsList,
})
}
}
Expand Down

0 comments on commit f4b0b61

Please sign in to comment.