add check of global sessionOn to prevent nil pointer panic: sessionOn of router is set to false while global sessionOn is false
This commit is contained in:
parent
963de3e68b
commit
7d7c4539d3
@ -781,7 +781,11 @@ func (p *ControllerRegister) serveHttp(ctx *beecontext.Context) {
|
||||
currentSessionOn = BConfig.WebConfig.Session.SessionOn
|
||||
originRouterInfo, originFindRouter = p.FindRouter(ctx)
|
||||
if originFindRouter {
|
||||
currentSessionOn = originRouterInfo.sessionOn
|
||||
if !currentSessionOn && originRouterInfo.sessionOn {
|
||||
logs.Warn("global sessionOn is false, sessionOn of router [%s] %s can't be set to true", ctx.Request.Method, ctx.Request.URL.Path)
|
||||
} else {
|
||||
currentSessionOn = originRouterInfo.sessionOn
|
||||
}
|
||||
}
|
||||
if currentSessionOn {
|
||||
ctx.Input.CruSession, err = GlobalSessions.SessionStart(rw, r)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user