From aaca522459a1c39eaf1436fa49b36c803bc4be68 Mon Sep 17 00:00:00 2001 From: Alfredo Braunstein Date: Mon, 7 Mar 2005 15:27:51 +0000 Subject: [PATCH] get rid of a crash git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9702 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 6 ++++++ src/text.C | 1 + src/text2.C | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ad2272deef..adc809859b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ + +2005-03-07 Alfredo Braunstein + + * text2.C (cursorUp): get rid of a crash + * text.C (x2pos): add an assert + 2005-03-07 Jean-Marc Lasgouttes * lyxfunc.C (getStatus): fix warning when assertions are disabled diff --git a/src/text.C b/src/text.C index bf07d9fc91..d28cf336ea 100644 --- a/src/text.C +++ b/src/text.C @@ -2215,6 +2215,7 @@ string LyXText::getPossibleLabel(LCursor & cur) const pos_type LyXText::x2pos(pit_type pit, int row, int x) const { + BOOST_ASSERT(row < pars_[pit].rows().size()); bool bound = false; Row const & r = pars_[pit].rows()[row]; return r.pos() + getColumnNearX(pit, r, x, bound); diff --git a/src/text2.C b/src/text2.C index d105e6f66e..1f52b8a41f 100644 --- a/src/text2.C +++ b/src/text2.C @@ -987,8 +987,8 @@ bool LyXText::cursorUp(LCursor & cur) x2pos(cur.pit(), row - 1, x)); } else if (cur.pit() > 0) { --cur.pit(); - updateNeeded |= setCursor(cur, cur.pit(), - x2pos(cur.pit(), par.rows().size() - 1, x)); + //cannot use 'par' now + updateNeeded |= setCursor(cur, cur.pit(), x2pos(cur.pit(), cur.paragraph().rows().size() - 1, x)); } cur.x_target() = x;