mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
handle nil pointer in ec2 discovery (#4469)
This handles a nil pointer that was being accessed in EC2 discovery. Fixes: #4441 Signed-off-by: noqcks <benny@noqcks.io>
This commit is contained in:
parent
8bb6e0dd6e
commit
46fb4078a6
|
@ -263,6 +263,9 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
|
|||
var subnets []string
|
||||
subnetsMap := make(map[string]struct{})
|
||||
for _, eni := range inst.NetworkInterfaces {
|
||||
if eni.SubnetId == nil {
|
||||
continue
|
||||
}
|
||||
if _, ok := subnetsMap[*eni.SubnetId]; !ok {
|
||||
subnetsMap[*eni.SubnetId] = struct{}{}
|
||||
subnets = append(subnets, *eni.SubnetId)
|
||||
|
|
Loading…
Reference in a new issue