mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-23 22:46:56 +01:00
PeerGroup: Fix IndexOutOfBoundsException if no peer fits the criteria when selecting the download peer.
This commit is contained in:
parent
efaae76fa9
commit
5d6ae4082b
1 changed files with 2 additions and 0 deletions
|
@ -2212,6 +2212,8 @@ public class PeerGroup implements TransactionBroadcaster {
|
|||
candidates2.add(peer);
|
||||
}
|
||||
}
|
||||
if (candidates2.isEmpty())
|
||||
return null;
|
||||
int index = (int) (Math.random() * candidates2.size());
|
||||
return candidates2.get(index);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue