From f03d2fb6efd41ec04e7f972abc7dc73856d38b14 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Thu, 26 Feb 2009 21:29:19 +0000 Subject: [PATCH] Fix bug 5765: http://bugzilla.lyx.org/show_bug.cgi?id=5765. [visual cursor] Crash when cutting a figure caption and moving the cursor. Avoid negative positions. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28629 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Cursor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index cd05e25645..88a2092f34 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -644,7 +644,7 @@ void Cursor::getSurroundingPos(pos_type & left_pos, pos_type & right_pos) // The cursor is painted *before* the character at pos(), or, if 'boundary' // is true, *after* the character at (pos() - 1). So we already have one // known position around the cursor: - pos_type known_pos = boundary() ? pos() - 1 : pos(); + pos_type known_pos = boundary() && pos() > 0 ? pos() - 1 : pos(); // edge case: if we're at the end of the paragraph, things are a little // different (because lastpos is a position which does not really "exist"