From c483bf955323f03687275edf85e9f9182b63ddb6 Mon Sep 17 00:00:00 2001 From: adman Date: Sun, 10 May 2026 14:30:28 +0200 Subject: [PATCH] if ctx is nil, set it to background context --- event/event_bus.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/event/event_bus.go b/event/event_bus.go index 21d7012..7960e13 100644 --- a/event/event_bus.go +++ b/event/event_bus.go @@ -240,6 +240,9 @@ func NewLoop() (l *Loop) { } func NewLoopCtx(ctx context.Context) (l *Loop) { + if ctx == nil { + ctx = context.Background() + } l = &Loop{} l.Ctx, l.Cancel = context.WithCancel(ctx) l.HandlerFunctions = make(map[reflect.Type][]reflect.Value)