From 459303729cc4f3ffdfbe05441dbeea0fc6be55e3 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 7 Jun 2006 17:05:25 +0000 Subject: [PATCH] * src/bufferparams.h: make author_map use an unsigned index, to avoid a warning. * src/text.C (readParToken): handle \change_inserted and \change_deleted tokens with wrong author index (bug 2614). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14028 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/bufferparams.h | 2 +- src/text.C | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) 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"),