mux: Reject empty patterns

This commit is contained in:
Adnan Maolood 2021-02-19 18:06:54 -05:00
parent 2e149c9ccd
commit 76967dad2e

3
mux.go
View File

@ -219,6 +219,9 @@ func (mux *ServeMux) ServeGemini(w ResponseWriter, r *Request) {
// Handle registers the handler for the given pattern.
// If a handler already exists for pattern, Handle panics.
func (mux *ServeMux) Handle(pattern string, handler Handler) {
if pattern == "" {
panic("gemini: invalid pattern")
}
if handler == nil {
panic("gemini: nil handler")
}