fix nil pointer dereference in azure discovery (#5587)

Signed-off-by: Dmitry Shmulevich <dmitry.shmulevich@sysdig.com>
This commit is contained in:
Dmitry Shmulevich 2019-05-21 12:03:24 -07:00 committed by Brian Brazil
parent d6a4daa26a
commit d81df5609d

View File

@ -335,7 +335,7 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
if *networkInterface.Primary { if *networkInterface.Primary {
for _, ip := range *networkInterface.IPConfigurations { for _, ip := range *networkInterface.IPConfigurations {
if ip.PublicIPAddress != nil { if ip.PublicIPAddress != nil && ip.PublicIPAddress.PublicIPAddressPropertiesFormat != nil {
labels[azureLabelMachinePublicIP] = model.LabelValue(*ip.PublicIPAddress.IPAddress) labels[azureLabelMachinePublicIP] = model.LabelValue(*ip.PublicIPAddress.IPAddress)
} }
if ip.PrivateIPAddress != nil { if ip.PrivateIPAddress != nil {