* src/frontends/controllers/ControlCitation.cpp:

- catch exception from boost::regex (bug 4421)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@22100 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-12-12 11:50:05 +00:00
parent cc5246782d
commit c84f22b5ca
2 changed files with 15 additions and 4 deletions

View File

@ -15,7 +15,7 @@
#include "Buffer.h"
#include "BufferParams.h"
#include "debug.h" // temporary
#include "debug.h"
#include "support/lstrings.h"
@ -137,8 +137,16 @@ vector<string> ControlCitation::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 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.
LYXERR(Debug::GUI) << e.what() << std::endl;
return vector<string>();
}
vector<string>::const_iterator it = keys_to_search.begin();
vector<string>::const_iterator end = keys_to_search.end();
@ -157,7 +165,8 @@ vector<string> ControlCitation::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() << std::endl;
return vector<string>();
}
}

View File

@ -157,6 +157,8 @@ What's new
- Fix a crash when inserting a file in a tabular cell via
Insert->File->Plain Text...
- Fix a crash when using the regex search of the citation dialog (bug 4421).
- Correctly adjust screen fonts after the zoom or dpi settings were changed in
the preferences (Mac and Windows only) (bug 4268).