mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
fix(plugin): prevent panic when ListenHosts is empty (#7565)
This commit is contained in:
@@ -31,7 +31,10 @@ func setup(c *caddy.Controller) error {
|
||||
go func() {
|
||||
deadline := time.Now().Add(30 * time.Second)
|
||||
conf := dnsserver.GetConfig(c)
|
||||
lh := conf.ListenHosts[0]
|
||||
lh := ""
|
||||
if len(conf.ListenHosts) > 0 {
|
||||
lh = conf.ListenHosts[0]
|
||||
}
|
||||
addr := net.JoinHostPort(lh, conf.Port)
|
||||
|
||||
for time.Now().Before(deadline) {
|
||||
|
||||
Reference in New Issue
Block a user