tests: fix nil pointer panic on failure (#23053)

This commit is contained in:
Marius van der Wijden 2021-06-18 12:21:34 +02:00 committed by GitHub
parent 97ce6dfa6d
commit 58aeab77d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,8 +74,10 @@ func TestState(t *testing.T) {
t.Run(key+"/snap", func(t *testing.T) { t.Run(key+"/snap", func(t *testing.T) {
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error { withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
snaps, statedb, err := test.Run(subtest, vmconfig, true) snaps, statedb, err := test.Run(subtest, vmconfig, true)
if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil { if snaps != nil && statedb != nil {
return err if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil {
return err
}
} }
return st.checkFailure(t, err) return st.checkFailure(t, err)
}) })