From c6ac350a3b53feb1dfcc24d82421cd20da61a163 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Thu, 20 Apr 2023 10:27:40 -0600 Subject: [PATCH] core: Return default logger if no modules loaded Fix report from: https://caddy.community/t/remote-caddyfile-invalid-memory-address-or-nil-pointer-dereference/19700/3 --- context.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/context.go b/context.go index fcefad19..615192c1 100644 --- a/context.go +++ b/context.go @@ -480,6 +480,9 @@ func (ctx Context) Logger(module ...Module) *zap.Logger { if len(module) > 0 { mod = module[0] } + if mod == nil { + return Log() + } return ctx.cfg.Logging.Logger(mod) }