From 7fe9713edf40e0c1d470f475655711f6c4454fd0 Mon Sep 17 00:00:00 2001 From: detailyang Date: Fri, 12 Jul 2019 20:23:54 +0800 Subject: [PATCH] bugfix: avoid nil reference when ignore is nil (#1414) Signed-off-by: detailyang --- collector/netdev_darwin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/netdev_darwin.go b/collector/netdev_darwin.go index c07e7fa182..c45e868588 100644 --- a/collector/netdev_darwin.go +++ b/collector/netdev_darwin.go @@ -42,7 +42,7 @@ func getNetDevStats(ignore *regexp.Regexp, accept *regexp.Regexp) (map[string]ma continue } - if ignore.MatchString(iface.Name) { + if ignore != nil && ignore.MatchString(iface.Name) { log.Debugf("Ignoring device: %s", iface.Name) continue }