]> git.lyx.org Git - lyx.git/commitdiff
get rid of a crash
authorAlfredo Braunstein <abraunst@lyx.org>
Mon, 7 Mar 2005 15:27:51 +0000 (15:27 +0000)
committerAlfredo Braunstein <abraunst@lyx.org>
Mon, 7 Mar 2005 15:27:51 +0000 (15:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9702 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text.C
src/text2.C

index ad2272deef392f6dc3c3498bfa748766552223f3..adc809859b4b11ce0a18cabd2d25124a292ae596 100644 (file)
@@ -1,3 +1,9 @@
+
+2005-03-07  Alfredo Braunstein  <abraunst@lyx.org>
+
+       * text2.C (cursorUp): get rid of a crash
+       * text.C (x2pos): add an assert
+
 2005-03-07  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * lyxfunc.C (getStatus): fix warning when assertions are disabled
index bf07d9fc9140dd7d142896f6bbb6605c49a76bdf..d28cf336eafb457d4ee02ecea21dfec65e50cea3 100644 (file)
@@ -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);
index d105e6f66e574c74b1caaa864d215c5fa7e4209b..1f52b8a41f78fab985a390fc617d25562bfbd6f5 100644 (file)
@@ -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;