Adds panic when using too many handlers
This commit is contained in:
parent
86824a640c
commit
cd92bf4385
@ -148,6 +148,9 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS
|
|||||||
|
|
||||||
func (group *RouterGroup) combineHandlers(handlers HandlersChain) HandlersChain {
|
func (group *RouterGroup) combineHandlers(handlers HandlersChain) HandlersChain {
|
||||||
finalSize := len(group.Handlers) + len(handlers)
|
finalSize := len(group.Handlers) + len(handlers)
|
||||||
|
if finalSize >= AbortIndex {
|
||||||
|
panic("too many handlers")
|
||||||
|
}
|
||||||
mergedHandlers := make(HandlersChain, finalSize)
|
mergedHandlers := make(HandlersChain, finalSize)
|
||||||
copy(mergedHandlers, group.Handlers)
|
copy(mergedHandlers, group.Handlers)
|
||||||
copy(mergedHandlers[len(group.Handlers):], handlers)
|
copy(mergedHandlers[len(group.Handlers):], handlers)
|
||||||
|
Loading…
Reference in New Issue
Block a user