fix npe for new wallets

This commit is contained in:
Craig Raw 2021-08-16 10:45:48 +02:00
parent eab42c0f05
commit 2eedd2290c

View file

@ -143,11 +143,13 @@ public class Wallet extends Persistable {
int index = -1; int index = -1;
for(Keystore keystore : getKeystores()) { for(Keystore keystore : getKeystores()) {
if(keystore.getKeyDerivation() != null) {
int keystoreAccount = getScriptType().getAccount(keystore.getKeyDerivation().getDerivationPath()); int keystoreAccount = getScriptType().getAccount(keystore.getKeyDerivation().getDerivationPath());
if(keystoreAccount != -1 && (index == -1 || keystoreAccount == index)) { if(keystoreAccount != -1 && (index == -1 || keystoreAccount == index)) {
index = keystoreAccount; index = keystoreAccount;
} }
} }
}
return index; return index;
} }