mirror of https://github.com/caddyserver/caddy.git
Added a null check to avoid segfault on rewrite query ops (#6191)
This commit is contained in:
parent
29f57faa86
commit
db9d167354
|
@ -117,13 +117,15 @@ func (rewr *Rewrite) Provision(ctx caddy.Context) error {
|
|||
}
|
||||
rep.re = re
|
||||
}
|
||||
|
||||
for _, replacementOp := range rewr.Query.Replace {
|
||||
err := replacementOp.Provision(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("compiling regular expression %s in query rewrite replace operation: %v", replacementOp.SearchRegexp, err)
|
||||
if rewr.Query != nil {
|
||||
for _, replacementOp := range rewr.Query.Replace {
|
||||
err := replacementOp.Provision(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("compiling regular expression %s in query rewrite replace operation: %v", replacementOp.SearchRegexp, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue