Skip to content

Commit

Permalink
Nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
francislavoie committed Apr 21, 2024
1 parent ae03e14 commit 6ef4c4d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/caddyhttp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}
Expand Down

0 comments on commit 6ef4c4d

Please sign in to comment.