3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 23:03:04 +00:00

Fix crash

This commit is contained in:
Mike Hearn 2014-04-26 00:32:23 +02:00
parent 3f3f637779
commit 119d26fda2

View File

@ -3450,8 +3450,8 @@ public class Wallet implements Serializable, BlockChainListener, PeerFilterProvi
// Of the coins we could spend, pick some that we actually will spend. // Of the coins we could spend, pick some that we actually will spend.
CoinSelector selector = req.coinSelector == null ? coinSelector : req.coinSelector; CoinSelector selector = req.coinSelector == null ? coinSelector : req.coinSelector;
CoinSelection selection = selector.select(valueNeeded, candidates); // selector is allowed to modify candidates list.
candidates = null; // Selector took ownership and might have changed candidates. Don't access again. CoinSelection selection = selector.select(valueNeeded, new LinkedList<TransactionOutput>(candidates));
// Can we afford this? // Can we afford this?
if (selection.valueGathered.compareTo(valueNeeded) < 0) { if (selection.valueGathered.compareTo(valueNeeded) < 0) {
valueMissing = valueNeeded.subtract(selection.valueGathered); valueMissing = valueNeeded.subtract(selection.valueGathered);