likexian / whois-parser

Whois parser for domain whois information parsing in Go(Golang).
Apache License 2.0
284 stars 86 forks source link

de域名解析出错 #51

Closed namecost closed 2 years ago

namecost commented 2 years ago

runtime error: invalid memory address or nil pointer dereference /usr/local/go/src/runtime/panic.go:220 (0x44a915) panicmem: panic(memoryError) /usr/local/go/src/runtime/signal_unix.go:818 (0x44a8e5) sigpanic: panicmem() /home/test/internal/whois/whois.go:269 (0x65db36) (*WhoisInfos).Single: registrar = result.Registrar.Name /home/test/internal/whois/whois.go:168 (0x65e1fa) Single: return DefaultWhoisInfos.Single(domain, whoisdatas) /home/test/internal/whois/whois.go:322 (0x65e1d2) GetSingleWhois: myinfos = Single(domain, tldwhois) /home/test/main.go:13 (0x7560a9) getWhoisSingle: myinfos := whois.GetSingleWhois(domain)

likexian commented 2 years ago

Hello @namecost It seems the panic is cased by your code but not whois parser.

try change

registrar = result.Registrar.Name

to

if result.Registrar != nil {
    registrar = result.Registrar.Name
}

If you think this repository is helpful, please share it with friends, thanks.