From b5eb59344cebc65093970c5018d8f356491a9cbd Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 13 Jan 2021 11:33:20 +0200 Subject: [PATCH] avoid npe on new wallet --- src/main/java/com/sparrowwallet/sparrow/net/Bwt.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/net/Bwt.java b/src/main/java/com/sparrowwallet/sparrow/net/Bwt.java index f1ee331b..6168a145 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/Bwt.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/Bwt.java @@ -62,7 +62,7 @@ public class Bwt { boolean forceRescan = false; for(Wallet wallet :wallets) { Date txBirthDate = wallet.getTransactions().values().stream().map(BlockTransactionHash::getDate).filter(Objects::nonNull).min(Date::compareTo).orElse(null); - if((wallet.getBirthDate() != null && txBirthDate != null && wallet.getBirthDate().before(txBirthDate)) || (txBirthDate == null && wallet.getStoredBlockHeight() == 0)) { + if((wallet.getBirthDate() != null && txBirthDate != null && wallet.getBirthDate().before(txBirthDate)) || (txBirthDate == null && wallet.getStoredBlockHeight() != null && wallet.getStoredBlockHeight() == 0)) { forceRescan = true; } }