From a899dc13c9d88717dde7f41c4334b0f836ed77c2 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 9 Nov 2004 16:49:38 +0000 Subject: [PATCH] fix off-by-one error (bug 1682) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9216 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/lengthcommon.C | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 0b60ab4ff0..69d2844669 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2004-11-09 Jean-Marc Lasgouttes + + * lengthcommon.C (unitFromString): fix off-by-one error (bug 1682) + 2004-11-05 Jean-Marc Lasgouttes * lyxfunc.C (dispatch): remove the verbose argument diff --git a/src/lengthcommon.C b/src/lengthcommon.C index 89ff7e1a55..ffb01bc566 100644 --- a/src/lengthcommon.C +++ b/src/lengthcommon.C @@ -61,7 +61,7 @@ char const * const unit_name_gui[] = { LyXLength::UNIT unitFromString(string const & data) { int i = 0; - while (i < num_units && data != unit_name[i]) + while (i < num_units - 1 && data != unit_name[i]) ++i; return static_cast(i); }