From 27af044a2dd2d0846dda5e5d97fd81a4d48532c3 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sat, 15 Feb 2014 20:53:03 -0500 Subject: [PATCH] It's definitely not safe to continue in this case. The cursor is invalid. So we should try to save the document before anything really bad happens. --- src/Cursor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 3ad16f49ff..9cca7b0d26 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -400,10 +400,12 @@ void Cursor::dispatch(FuncRequest const & cmd0) for (; depth(); pop(), boundary(false)) { LYXERR(Debug::DEBUG, "Cursor::dispatch: cmd: " << cmd0 << endl << *this); - // LASSERT: Is it safe to continue here, or should we return? - LASSERT(pos() <= lastpos(), /**/); - LASSERT(idx() <= lastidx(), /**/); - LASSERT(pit() <= lastpit(), /**/); + + // In any of these cases, the cursor is invalid, and we should + // try to save this document rather than crash. + LBUFERR(pos() <= lastpos()); + LBUFERR(idx() <= lastidx()); + LBUFERR(pit() <= lastpit()); // The common case is 'LFUN handled, need update', so make the // LFUN handler's life easier by assuming this as default value. -- 2.39.2