diff --git a/src/lib.rs b/src/lib.rs index 3baa9fd..8bffc66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1162,4 +1162,16 @@ mod tests { use crate::canonicalize_and_process::canonicalize_pathname; assert!(canonicalize_pathname("3�/..").is_ok()); } + + #[test] + fn matcher_matches_doesnt_crash() { + let input = "(H\\PH)e:*) (emH\\(input, base_url); + let _ = init.and_then(|init_res| { + UrlPattern::::parse(init_res, Default::default()) + }); + } } diff --git a/src/matcher.rs b/src/matcher.rs index 6f7c810..4a94ab4 100644 --- a/src/matcher.rs +++ b/src/matcher.rs @@ -94,7 +94,7 @@ impl Matcher { Some(vec![Some(input)]) } InnerMatcher::RegExp { regexp, .. } => { - regexp.as_ref().unwrap().matches(input) + regexp.as_ref().ok()?.matches(input) } } }