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:
Maxim Korotkov 2025-08-15 18:26:41 +03:00 committed by GitHub
parent 7859137737
commit 1c2d011f59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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]
}
}
}