From ecc36be60baba3b3b093f4b9b8454bf11b2fb2f9 Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Sun, 16 Apr 2017 11:27:34 +0200 Subject: [PATCH] findadv: avoid crash when regexp-based search fails (mitigates #10625). --- src/lyxfind.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index bb4e985a54..9e79d78dbe 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -961,6 +961,8 @@ int MatchStringAdv::findAux(DocIterator const & cur, int len, bool at_begin) con LYXERR(Debug::FIND, "Searching in regexp mode: at_begin=" << at_begin); regex const & p_regexp = at_begin ? regexp : regexp2; sregex_iterator re_it(str.begin(), str.end(), p_regexp); + if (re_it == std::sregex_iterator()) + return 0; match_results const & m = *re_it; // Check braces on the segment that matched the entire regexp expression, -- 2.39.2