diff --git a/src/bufferparams.h b/src/bufferparams.h index 80d7e606da..8f70225bfd 100644 --- a/src/bufferparams.h +++ b/src/bufferparams.h @@ -223,7 +223,7 @@ public: AuthorList const & authors() const; /// map of the file's author IDs to buffer author IDs - std::vector author_map; + std::vector author_map; /// std::string const dvips_options() const; /// diff --git a/src/text.C b/src/text.C index 729c9cad09..47d782f0e0 100644 --- a/src/text.C +++ b/src/text.C @@ -328,14 +328,28 @@ void readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex, int aid; lyx::time_type ct; is >> aid >> ct; - change = Change(Change::INSERTED, bp.author_map[aid], ct); + if (aid >= bp.author_map.size()) { + buf.error(ErrorItem(_("Change tracking error"), + bformat(_("Unknown author index for insertion: %1$d\n"), aid), + par.id(), 0, par.size())); + + change = Change(Change::UNCHANGED); + } else + change = Change(Change::INSERTED, bp.author_map[aid], ct); } else if (token == "\\change_deleted") { lex.eatLine(); std::istringstream is(lex.getString()); int aid; lyx::time_type ct; is >> aid >> ct; - change = Change(Change::DELETED, bp.author_map[aid], ct); + if (aid >= bp.author_map.size()) { + buf.error(ErrorItem(_("Change tracking error"), + bformat(_("Unknown author index for deletion: %1$d\n"), aid), + par.id(), 0, par.size())); + + change = Change(Change::UNCHANGED); + } else + change = Change(Change::DELETED, bp.author_map[aid], ct); } else { lex.eatLine(); buf.error(ErrorItem(_("Unknown token"),