diff --git a/include/boost/regex/v4/perl_matcher_common.hpp b/include/boost/regex/v4/perl_matcher_common.hpp index d339f907..c3ce7d7b 100644 --- a/include/boost/regex/v4/perl_matcher_common.hpp +++ b/include/boost/regex/v4/perl_matcher_common.hpp @@ -41,7 +41,13 @@ perl_matcher::perl_matcher(BidiIter next_count(&rep_obj), rep_obj(&next_count) { typedef typename regex_iterator_traits::iterator_category category; - + + if(e.empty()) + { + // precondition failure: e is not a valid regex. + std::invalid_argument ex("Invalid regular expression object"); + boost::throw_exception(ex); + } pstate = 0; m_match_flags = f; icase = re.flags() & regex_constants::icase;