mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
fix(plugin): prevent panic when ListenHosts is empty (#7565)
This commit is contained in:
@@ -37,7 +37,7 @@ func traceParse(c *caddy.Controller) (*trace, error) {
|
||||
)
|
||||
|
||||
cfg := dnsserver.GetConfig(c)
|
||||
if cfg.ListenHosts[0] != "" {
|
||||
if len(cfg.ListenHosts) > 0 && cfg.ListenHosts[0] != "" {
|
||||
tr.serviceEndpoint = cfg.ListenHosts[0] + ":" + cfg.Port
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user