Skip to content

Commit 1c2d011

Browse files
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>
1 parent 7859137 commit 1c2d011

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

middleware/url_format.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ func URLFormat(next http.Handler) http.Handler {
6363
idx += base
6464
format = path[idx+1:]
6565

66-
rctx.RoutePath = path[:idx]
66+
if rctx != nil {
67+
rctx.RoutePath = path[:idx]
68+
}
6769
}
6870
}
6971

0 commit comments

Comments
 (0)