Skip to content

Commit

Permalink
Panic if node for middleware path does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
vardius committed Jan 16, 2020
1 parent 9233b04 commit 0d328e6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ func addMiddleware(t mux.Tree, method, path string, mid middleware.Middleware) {
if root := t.Find(method); root != nil {
if path != "" {
node := findNode(root, strings.Split(pathutils.TrimSlash(path), "/"))
if node != nil {
c(c, node, mid)
if node == nil {
panic("Could not find node for given path")
}

c(c, node, mid)
} else {
c(c, root, mid)
}
Expand Down

0 comments on commit 0d328e6

Please sign in to comment.