]> git.lyx.org Git - features.git/commitdiff
Fix bug http://bugzilla.lyx.org/show_bug.cgi?id=4421
authorAbdelrazak Younes <younes@lyx.org>
Wed, 12 Dec 2007 10:52:23 +0000 (10:52 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 12 Dec 2007 10:52:23 +0000 (10:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22098 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiCitation.cpp

index 65a6b4cf6aeaecc5436f4d71d0d6b45e6e84c578..d224cf1c85b024f68adac3b328f450b32244e803 100644 (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>();
                }
        }