From 0a2873a22fe2abd1d318cfe7bdc12836cfb7a675 Mon Sep 17 00:00:00 2001 From: phuoc Date: Wed, 21 Aug 2024 21:10:46 +0700 Subject: [PATCH] guard against nil iface --- cmd/serf/command/agent/command.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/serf/command/agent/command.go b/cmd/serf/command/agent/command.go index e8b7b60dd..ef314e3db 100644 --- a/cmd/serf/command/agent/command.go +++ b/cmd/serf/command/agent/command.go @@ -454,9 +454,9 @@ func (c *Command) startAgent(config *Config, agent *Agent, // Get the bind interface if any iface, _ := config.MDNSNetworkInterface() - - c.logger.Printf("[INFO] agent: Starting mDNS listener on interface %s", iface.Name) - + if iface != nil { + c.logger.Printf("[INFO] agent: Starting mDNS listener on interface %s", iface.Name) + } _, err := NewAgentMDNS(agent, logOutput, config.ReplayOnJoin, config.NodeName, config.Discover, iface, local.Addr, int(local.Port), config.MDNS) if err != nil {