Skip to content

Commit 4fa1cc7

Browse files
router: avoid out of range with empty path(#204)
Co-authored-by: Julien Schmidt <[email protected]>
1 parent e62e5df commit 4fa1cc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func (r *Router) DELETE(path string, handle Handle) {
232232
// frequently used, non-standardized or custom methods (e.g. for internal
233233
// communication with a proxy).
234234
func (r *Router) Handle(method, path string, handle Handle) {
235-
if path[0] != '/' {
235+
if len(path) < 1 || path[0] != '/' {
236236
panic("path must begin with '/' in path '" + path + "'")
237237
}
238238

0 commit comments

Comments
 (0)