Adds panic when using too many handlers

This commit is contained in:
Manu Mtz-Almeida 2015-05-31 04:34:21 +02:00
parent 86824a640c
commit cd92bf4385
1 changed files with 3 additions and 0 deletions

View File

@ -148,6 +148,9 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS
func (group *RouterGroup) combineHandlers(handlers HandlersChain) HandlersChain {
finalSize := len(group.Handlers) + len(handlers)
if finalSize >= AbortIndex {
panic("too many handlers")
}
mergedHandlers := make(HandlersChain, finalSize)
copy(mergedHandlers, group.Handlers)
copy(mergedHandlers[len(group.Handlers):], handlers)