Fixed nill pointer error.

This commit is contained in:
philip-morlier 2022-05-25 14:39:54 -07:00
parent 2f93e2ae10
commit 80ee3f61e6

View File

@ -872,17 +872,20 @@ func (api *API) traceTx(ctx context.Context, message core.Message, txctx *Contex
} }
// Default tracer is the struct logger // Default tracer is the struct logger
tracer = logger.NewStructLogger(config.Config) tracer = logger.NewStructLogger(config.Config)
if config.Tracer != nil {
// Get the tracer from the plugin loader // Get the tracer from the plugin loader
//begin PluGeth code injection //begin PluGeth code injection
if tr, ok := getPluginTracer(*config.Tracer); ok { if tr, ok := getPluginTracer(*config.Tracer); ok {
//end PluGeth code injection //end PluGeth code injection
tracer = tr(statedb, vmctx) tracer = tr(statedb, vmctx)
} else if config.Tracer != nil { } else {
tracer, err = New(*config.Tracer, txctx) tracer, err = New(*config.Tracer, txctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
} }
}
// Define a meaningful timeout of a single transaction trace // Define a meaningful timeout of a single transaction trace
if config.Timeout != nil { if config.Timeout != nil {
if timeout, err = time.ParseDuration(*config.Timeout); err != nil { if timeout, err = time.ParseDuration(*config.Timeout); err != nil {