From 6ef4c4dfcd0fd487cc5fb564ce2116f48972c772 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Sun, 21 Apr 2024 07:08:59 -0400 Subject: [PATCH] Nil check --- modules/caddyhttp/app.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/caddyhttp/app.go b/modules/caddyhttp/app.go index 6b82e848c2e..4df8689a531 100644 --- a/modules/caddyhttp/app.go +++ b/modules/caddyhttp/app.go @@ -350,9 +350,11 @@ func (app *App) Validate() error { } // logger names must not have ports - for host := range srv.Logs.LoggerNames { - if _, _, err := net.SplitHostPort(host); err == nil { - return fmt.Errorf("server %s: logger name must not have a port: %s", srvName, host) + if srv.Logs != nil { + for host := range srv.Logs.LoggerNames { + if _, _, err := net.SplitHostPort(host); err == nil { + return fmt.Errorf("server %s: logger name must not have a port: %s", srvName, host) + } } } }