Wallet: Check early for null context or params.

This commit is contained in:
Andreas Schildbach
2018-08-01 19:31:11 +02:00
parent 90c3cccb6f
commit 5df91ca886

View File

@@ -348,8 +348,8 @@ public class Wallet extends BaseTaggableObject
} }
private Wallet(Context context, KeyChainGroup keyChainGroup) { private Wallet(Context context, KeyChainGroup keyChainGroup) {
this.context = context; this.context = checkNotNull(context);
this.params = context.getParams(); this.params = checkNotNull(context.getParams());
this.keyChainGroup = checkNotNull(keyChainGroup); this.keyChainGroup = checkNotNull(keyChainGroup);
if (params.getId().equals(NetworkParameters.ID_UNITTESTNET)) if (params.getId().equals(NetworkParameters.ID_UNITTESTNET))
this.keyChainGroup.setLookaheadSize(5); // Cut down excess computation for unit tests. this.keyChainGroup.setLookaheadSize(5); // Cut down excess computation for unit tests.