From eb2a4d4d4cd47f4e373b61222402dcd0ec974224 Mon Sep 17 00:00:00 2001 From: detailyang Date: Wed, 3 Jul 2019 13:24:16 +0800 Subject: [PATCH] bugfix: avoid nil reference when ignore is nil 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 }