Avoid potential nil dereference (#1008)
Fixes: 0fe6bf1 ("Use RoutePath in URLFormat middleware (#718)")
Found by PostgresPro with Svace Static Analyzer
Signed-off-by: Maksim Korotkov <m.korotkov@postgrespro.ru>
This commit is contained in:
parent
7859137737
commit
1c2d011f59
1 changed files with 3 additions and 1 deletions
|
|
@ -63,7 +63,9 @@ func URLFormat(next http.Handler) http.Handler {
|
|||
idx += base
|
||||
format = path[idx+1:]
|
||||
|
||||
rctx.RoutePath = path[:idx]
|
||||
if rctx != nil {
|
||||
rctx.RoutePath = path[:idx]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue