matcher: remove an undefined behavior
Indexing into a zero-length std::vector is an undefined behavior.
@@ -244,6 +244,10 @@ cdef class Matcher:
pipe = "parser"
error_msg = Errors.E155.format(pipe=pipe, attr=self.vocab.strings.as_string(attr))
raise ValueError(error_msg)
+
+ if self.patterns.empty():
+ matches = []
+ else:
matches = find_matches(&self.patterns[0], self.patterns.size(), doclike, length,
extensions=self._extensions, predicates=self._extra_predicates, with_alignments=with_alignments)
final_matches = []
