mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-31 12:01:24 +00:00
KeyChainGroup: Fix NullPointerException in findRedeemDataFromScriptHash() if no deterministic keychain is in the group.
This commit is contained in:
@@ -502,12 +502,14 @@ public class KeyChainGroup implements KeyBag {
|
|||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public RedeemData findRedeemDataFromScriptHash(byte[] scriptHash) {
|
public RedeemData findRedeemDataFromScriptHash(byte[] scriptHash) {
|
||||||
// Iterate in reverse order, since the active keychain is the one most likely to have the hit
|
if (chains != null) {
|
||||||
for (Iterator<DeterministicKeyChain> iter = chains.descendingIterator() ; iter.hasNext() ; ) {
|
// Iterate in reverse order, since the active keychain is the one most likely to have the hit
|
||||||
DeterministicKeyChain chain = iter.next();
|
for (Iterator<DeterministicKeyChain> iter = chains.descendingIterator(); iter.hasNext();) {
|
||||||
RedeemData redeemData = chain.findRedeemDataByScriptHash(ByteString.copyFrom(scriptHash));
|
DeterministicKeyChain chain = iter.next();
|
||||||
if (redeemData != null)
|
RedeemData redeemData = chain.findRedeemDataByScriptHash(ByteString.copyFrom(scriptHash));
|
||||||
return redeemData;
|
if (redeemData != null)
|
||||||
|
return redeemData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user