mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-01 21:17:13 +00:00
PeerGroup: Fix IndexOutOfBoundsException if no peer fits the criteria when selecting the download peer.
This commit is contained in:
@@ -2212,6 +2212,8 @@ public class PeerGroup implements TransactionBroadcaster {
|
|||||||
candidates2.add(peer);
|
candidates2.add(peer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (candidates2.isEmpty())
|
||||||
|
return null;
|
||||||
int index = (int) (Math.random() * candidates2.size());
|
int index = (int) (Math.random() * candidates2.size());
|
||||||
return candidates2.get(index);
|
return candidates2.get(index);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user