Fixed NPE introduced in earlier commit.

This commit is contained in:
CalDescent 2021-08-22 15:20:28 +01:00
parent 01d66212da
commit 44607ba6a4

View File

@ -1421,10 +1421,12 @@ public class Controller extends Thread {
BlockData blockData = repository.getBlockRepository().fromReference(parentSignature); BlockData blockData = repository.getBlockRepository().fromReference(parentSignature);
if (PruneManager.getInstance().isBlockPruned(blockData.getHeight(), repository)) { if (blockData != null) {
// If this request contains a pruned block, we likely only have partial data, so best not to sent anything if (PruneManager.getInstance().isBlockPruned(blockData.getHeight(), repository)) {
// We always prune from the oldest first, so it's fine to just check the first block requested // If this request contains a pruned block, we likely only have partial data, so best not to sent anything
blockData = null; // We always prune from the oldest first, so it's fine to just check the first block requested
blockData = null;
}
} }
while (blockData != null && blockSummaries.size() < numberRequested) { while (blockData != null && blockSummaries.size() < numberRequested) {