mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Be careful about unparsable bibtex years
Handle gracefully the case where the regex that parses a year fails.
This is a fixup to ba171930
(spotted by coverity).
This commit is contained in:
parent
4b8e5a9d53
commit
e2f2915f8e
@ -417,7 +417,9 @@ docstring const BibTeXInfo::getYear() const
|
||||
static regex const ereg(".*/[-]?([\\d]{4}).*");
|
||||
smatch sm;
|
||||
string const date = to_utf8(year);
|
||||
regex_match(date, sm, yreg);
|
||||
if (!regex_match(date, sm, yreg))
|
||||
// cannot parse year.
|
||||
return docstring();
|
||||
year = from_ascii(sm[1]);
|
||||
// check for an endyear
|
||||
if (regex_match(date, sm, ereg))
|
||||
|
Loading…
Reference in New Issue
Block a user