mirror of https://github.com/status-im/consul.git
Guard against a nil ServerDetails.Addr
It's not clear how or why this would ever be nil, but some of the unit tests produce a nil addr. Be defensive.
This commit is contained in:
parent
ca5950a538
commit
970938c2dd
|
@ -35,10 +35,14 @@ type ServerDetails struct {
|
|||
|
||||
// Key returns the corresponding Key
|
||||
func (s *ServerDetails) Key() *Key {
|
||||
var serverAddr string
|
||||
if s.Addr != nil {
|
||||
serverAddr = s.Addr.String() + s.Addr.Network()
|
||||
}
|
||||
return &Key{
|
||||
Datacenter: s.Datacenter,
|
||||
Port: s.Port,
|
||||
AddrString: s.Addr.String() + s.Addr.Network(),
|
||||
AddrString: serverAddr,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue