Return nil in GetAddress if no addresses present.

Honestly thought we already did this, but turns out no.
This commit is contained in:
Owain G. Ainsworth 2013-10-02 20:18:13 +01:00
parent ad12d10503
commit 70f15f434f

View file

@ -764,6 +764,10 @@ func NetAddressKey(na *btcwire.NetAddress) string {
// have not been used recently and should not pick 'close' addresses
// consecutively.
func (a *AddrManager) GetAddress(class string, newBias int) *knownAddress {
if a.NumAddresses() == 0 {
return nil
}
// Protect concurrent access.
a.mtx.Lock()
defer a.mtx.Unlock()