Skip to content

fix: guard routeRegexp.Match against nil receiver or regexp#803

Open
leno23 wants to merge 1 commit into
gorilla:mainfrom
leno23:fix/route-regexp-nil-match-749
Open

fix: guard routeRegexp.Match against nil receiver or regexp#803
leno23 wants to merge 1 commit into
gorilla:mainfrom
leno23:fix/route-regexp-nil-match-749

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 26, 2026

Summary

Fixes #749

Avoid panics in (*routeRegexp).Match when the receiver or compiled regexp field is nil by returning false instead.

Also guards variable extraction in routeRegexpGroup.setMatch and matchQueryString.

Test plan

  • go test ./...
  • Added TestRouteRegexpMatchNilReceiver and TestRouteRegexpMatchNilRegexp

Made with Cursor

Fixes gorilla#749

Return false instead of panicking when routeRegexp or its compiled
regexp is nil. Also skip variable extraction when query/host/path
regexps are unset.

Co-authored-by: Cursor <cursoragent@cursor.com>
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] runtime error in (*routeRegexp).Match

1 participant