From 9191e97ca345dff5e433f7e2cdb2ffda13f04d75 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Fri, 10 Nov 2023 10:49:25 +0100 Subject: [PATCH] tests: fix nil deref --- tests/block_test_util.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 526f0b7c71..6d9e8c808c 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -162,9 +162,9 @@ func (t *BlockTest) Run(snapshotter bool, scheme string, tracer vm.EVMLogger, po } // Import succeeded: regardless of whether the _test_ succeeds or not, schedule // the post-check to run - defer func() { - postCheck(result, chain) - }() + if postCheck != nil { + defer postCheck(result, chain) + } cmlast := chain.CurrentBlock().Hash() if common.Hash(t.json.BestBlock) != cmlast { return fmt.Errorf("last block hash validation mismatch: want: %x, have: %x", t.json.BestBlock, cmlast)