Commit 4a8bd8f8 authored by Juan Benet's avatar Juan Benet

Merge pull request #11 from jbenet/fix/nil-addr

return error if passed nil net.Addr
parents 861fd197 74e0b7e9
......@@ -13,6 +13,10 @@ var errIncorrectNetAddr = fmt.Errorf("incorrect network addr conversion")
// FromNetAddr converts a net.Addr type to a Multiaddr.
func FromNetAddr(a net.Addr) (ma.Multiaddr, error) {
if a == nil {
return nil, fmt.Errorf("nil multiaddr")
}
switch a.Network() {
case "tcp", "tcp4", "tcp6":
ac, ok := a.(*net.TCPAddr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment