git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22098 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-12 10:52:23 +00:00
parent 9383f4c3c6
commit 503a41ad15

View File

@ -691,8 +691,16 @@ vector<docstring> GuiCitation::searchKeys(
// it is treated as a simple string by boost::regex.
expr = escape_special_chars(expr);
boost::regex reg_exp(to_utf8(expr), case_sensitive ?
boost::regex_constants::normal : boost::regex_constants::icase);
boost::regex reg_exp;
try {
reg_exp.assign(to_utf8(expr), case_sensitive ?
boost::regex_constants::normal : boost::regex_constants::icase);
} catch (boost::regex_error & e) {
// boost::regex throws an exception if the regular expression is not
// valid.
LYXERR0(Debug::GUI, e.what());
return vector<docstring>();
}
vector<docstring>::const_iterator it = keys_to_search.begin();
vector<docstring>::const_iterator end = keys_to_search.end();
@ -717,7 +725,8 @@ vector<docstring> GuiCitation::searchKeys(
if (boost::regex_search(data, reg_exp))
foundKeys.push_back(*it);
}
catch (boost::regex_error &) {
catch (boost::regex_error & e) {
LYXERR(Debug::GUI, e.what());
return vector<docstring>();
}
}