Skip to content

Return error from Registry.Get when store.New returns a nil session#292

Closed
c-tonneslan wants to merge 1 commit into
gorilla:mainfrom
c-tonneslan:fix-registry-nil-session-panic
Closed

Return error from Registry.Get when store.New returns a nil session#292
c-tonneslan wants to merge 1 commit into
gorilla:mainfrom
c-tonneslan:fix-registry-nil-session-panic

Conversation

@c-tonneslan
Copy link
Copy Markdown

Fixes #288. Registry.Get assumed store.New always returned a non-nil session, but a Store is free to return (nil, err). The next line touched session.name and panicked with a nil pointer dereference.

Just return the error directly when the store gives back no session. Added a regression test that exercises the failing-store path.

Fixes #288

If a Store's New method returns (nil, err), Registry.Get used to
dereference session.name on the nil pointer and panic. Return the
error directly when New gives back no session.

Fixes gorilla#288

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
@c-tonneslan
Copy link
Copy Markdown
Author

Closing in favor of #291 which I already had open for the same issue. Sorry for the duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Panic if store.New returns an error

1 participant