diff --git a/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java b/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java
index <HASH>..<HASH> 100644
--- a/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java
+++ b/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java
@@ -157,6 +157,10 @@ public class BitcoindComparisonTool {
                     return null;
                 } else if (m instanceof GetHeadersMessage) {
                     try {
+                        if (currentBlock.block == null) {
+                            log.info("Got a request for a header before we had even begun processing blocks!");
+                            return null;
+                        }
                         LinkedList<Block> headers = new LinkedList<Block>();
                         Block it = blockList.hashHeaderMap.get(currentBlock.block.getHash());
                         while (it != null) {
Fix potential headers-first NPE race