From 0d4546c9655f871f1cecd3fb8ce7dc9c6598cc24 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 11 Nov 2016 20:49:22 -0600 Subject: [PATCH] server: Return error on address lookup fails. This corrects an issue introduced by commit e8f63bc29550705268b533032ccc2ea24f8c86ba where a failure to lookup a hostname could lead to a panic in certain circumstances. An error is now returned in that case as expected. --- server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.go b/server.go index e18b373c..668dc991 100644 --- a/server.go +++ b/server.go @@ -2516,6 +2516,9 @@ func addrStringToNetAddr(addr string) (net.Addr, error) { if err != nil { return nil, err } + if len(ips) == 0 { + return nil, fmt.Errorf("no addresses found for %s", host) + } port, err := strconv.Atoi(strPort) if err != nil {