From 80ee3f61e697d9ab82feb6827614d5c8b05de1a6 Mon Sep 17 00:00:00 2001 From: philip-morlier Date: Wed, 25 May 2022 14:39:54 -0700 Subject: [PATCH] Fixed nill pointer error. --- eth/tracers/api.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 8fd564abd..f04206f49 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -872,15 +872,18 @@ func (api *API) traceTx(ctx context.Context, message core.Message, txctx *Contex } // Default tracer is the struct logger tracer = logger.NewStructLogger(config.Config) - // Get the tracer from the plugin loader - //begin PluGeth code injection - if tr, ok := getPluginTracer(*config.Tracer); ok { - //end PluGeth code injection - tracer = tr(statedb, vmctx) - } else if config.Tracer != nil { - tracer, err = New(*config.Tracer, txctx) - if err != nil { - return nil, err + + if config.Tracer != nil { + // Get the tracer from the plugin loader + //begin PluGeth code injection + if tr, ok := getPluginTracer(*config.Tracer); ok { + //end PluGeth code injection + tracer = tr(statedb, vmctx) + } else { + tracer, err = New(*config.Tracer, txctx) + if err != nil { + return nil, err + } } } // Define a meaningful timeout of a single transaction trace