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,9 +74,11 @@ 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 snaps != nil && statedb != nil {
if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil {
return err
}
}
return st.checkFailure(t, err)
})
})