Merge pull request #510 from jfolkins/fix_sessregenid
fix: added nil check on c.CruSession to prevent crash
Showing
1 changed file
with
3 additions
and
1 deletions
| ... | @@ -397,7 +397,9 @@ func (c *Controller) DelSession(name interface{}) { | ... | @@ -397,7 +397,9 @@ func (c *Controller) DelSession(name interface{}) { |
| 397 | // SessionRegenerateID regenerates session id for this session. | 397 | // SessionRegenerateID regenerates session id for this session. |
| 398 | // the session data have no changes. | 398 | // the session data have no changes. |
| 399 | func (c *Controller) SessionRegenerateID() { | 399 | func (c *Controller) SessionRegenerateID() { |
| 400 | c.CruSession.SessionRelease(c.Ctx.ResponseWriter) | 400 | if c.CruSession != nil { |
| 401 | c.CruSession.SessionRelease(c.Ctx.ResponseWriter) | ||
| 402 | } | ||
| 401 | c.CruSession = GlobalSessions.SessionRegenerateId(c.Ctx.ResponseWriter, c.Ctx.Request) | 403 | c.CruSession = GlobalSessions.SessionRegenerateId(c.Ctx.ResponseWriter, c.Ctx.Request) |
| 402 | c.Ctx.Input.CruSession = c.CruSession | 404 | c.Ctx.Input.CruSession = c.CruSession |
| 403 | } | 405 | } | ... | ... |
-
Please register or sign in to post a comment