From: Abdelrazak Younes Date: Wed, 12 Dec 2007 10:52:23 +0000 (+0000) Subject: Fix bug http://bugzilla.lyx.org/show_bug.cgi?id=4421 X-Git-Tag: 1.6.10~6963 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=503a41ad15a7a88507ad32cdffd29ea4b4418316;p=features.git Fix bug http://bugzilla.lyx.org/show_bug.cgi?id=4421 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22098 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index 65a6b4cf6a..d224cf1c85 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -691,8 +691,16 @@ vector 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(); + } vector::const_iterator it = keys_to_search.begin(); vector::const_iterator end = keys_to_search.end(); @@ -717,7 +725,8 @@ vector 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(); } }