From 58aeab77d219204af414602d30ae34d5adf10382 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Fri, 18 Jun 2021 12:21:34 +0200 Subject: [PATCH] tests: fix nil pointer panic on failure (#23053) --- tests/state_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/state_test.go b/tests/state_test.go index 43009afdd..01ed1772e 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -74,8 +74,10 @@ func TestState(t *testing.T) { t.Run(key+"/snap", func(t *testing.T) { withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error { snaps, statedb, err := test.Run(subtest, vmconfig, true) - if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil { - return err + if snaps != nil && statedb != nil { + if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil { + return err + } } return st.checkFailure(t, err) })