Skip to content

Commit

Permalink
adding a guard so that a nil device is not crashing (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
i3149 authored Jul 9, 2024
1 parent 39852d1 commit 18ea2ed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/inputs/snmp/snmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ func parseConfig(ctx context.Context, file string, log logger.ContextL) (*kt.Snm
}

// Correctly format all the user tags needed here:
for _, device := range ms.Devices {
for dname, device := range ms.Devices {
if device == nil {
log.Errorf("Device %s is nil. Skipping.", dname)
continue
}
setDeviceTagsAndMatch(device) // Tweak any per provider tags and match attributes here now that we have the actual provider.
device.InitUserTags(ServiceName)
}
Expand Down

0 comments on commit 18ea2ed

Please sign in to comment.