3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

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

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
}