a89f14d8 by astaxie

Merge pull request #1227 from oiooj/develop

fix FilterHandler crash issue 
2 parents f7f390df 87e8bcc9
...@@ -616,6 +616,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -616,6 +616,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
616 } 616 }
617 if ok, params := filterR.ValidRouter(urlPath); ok { 617 if ok, params := filterR.ValidRouter(urlPath); ok {
618 for k, v := range params { 618 for k, v := range params {
619 if context.Input.Params == nil {
620 context.Input.Params = make(map[string]string)
621 }
619 context.Input.Params[k] = v 622 context.Input.Params[k] = v
620 } 623 }
621 filterR.filterFunc(context) 624 filterR.filterFunc(context)
...@@ -699,7 +702,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -699,7 +702,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
699 p[strconv.Itoa(k)] = v 702 p[strconv.Itoa(k)] = v
700 } 703 }
701 } 704 }
702 context.Input.Params = p 705 if p != nil {
706 context.Input.Params = p
707 }
703 } 708 }
704 } 709 }
705 710
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!