fix: don't extract nil IPs in the GCP platform

This fix is same as #4152.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Andrey Smirnov 2021-08-26 17:30:05 +03:00
parent ba169c6f91
commit c4048e263d
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD

View File

@ -100,7 +100,9 @@ func (g *GCP) ExternalIPs(ctx context.Context) (addrs []net.IP, err error) {
for _, networkInterface := range m {
for _, accessConfig := range networkInterface.AccessConfigs {
addrs = append(addrs, net.ParseIP(accessConfig.ExternalIP))
if addr := net.ParseIP(accessConfig.ExternalIP); addr != nil {
addrs = append(addrs, addr)
}
}
}