net: Fix issue where some local clients would break.

Ran into this on Windows, when it didn't return "localhost" as a possible name for 127.0.0.1 or ::1.
This commit is contained in:
Daniel Oaks 2016-10-13 16:34:04 +10:00
parent 985f87d9d1
commit 3c2fae666a
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ func AddrLookupHostname(addr net.Addr) string {
func LookupHostname(addr string) string {
names, err := net.LookupAddr(addr)
if err != nil || !IsHostname(names[0]) {
if err != nil || len(names) < 1 || !IsHostname(names[0]) {
// return original address
return addr
}