Commit 4a608f64 authored by zhiqiangxu's avatar zhiqiangxu Committed by GitHub

move AttachEmitter block inside nil check (#12144)

parent 46807900
...@@ -147,12 +147,13 @@ func (s *Sys) Register(name string, deriver Deriver, opts *RegisterOpts) Emitter ...@@ -147,12 +147,13 @@ func (s *Sys) Register(name string, deriver Deriver, opts *RegisterOpts) Emitter
} }
}) })
} }
// If it can emit, attach an emitter to it
if attachTo, ok := deriver.(AttachEmitter); ok {
attachTo.AttachEmitter(em)
}
// If it can derive, add it to the executor (and only after attaching the emitter) // If it can derive, add it to the executor (and only after attaching the emitter)
if deriver != nil { if deriver != nil {
// If it can emit, attach an emitter to it
if attachTo, ok := deriver.(AttachEmitter); ok {
attachTo.AttachEmitter(em)
}
r.leaveExecutor = s.executor.Add(r, &opts.Executor) r.leaveExecutor = s.executor.Add(r, &opts.Executor)
} }
return em return em
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment