diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2023-04-20 10:27:40 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2023-04-20 10:27:40 -0600 |
commit | c6ac350a3b53feb1dfcc24d82421cd20da61a163 (patch) | |
tree | 0be4ecd835a619438518ef0a5abc5d87e0e18ca2 | |
parent | b301a3df70232fe00de186b0586dcec8bf0d2559 (diff) |
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
-rw-r--r-- | context.go | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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) } |