[LyX/master] Fix crash when attempting to search in selection that contains only math

Juergen Spitzmueller spitz at lyx.org
Mon Jul 15 15:42:06 UTC 2024


commit cca68d0614269edfc256db82b3849afde4640dd7
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Mon Jul 15 17:41:10 2024 +0200

    Fix crash when attempting to search in selection that contains only math
---
 src/lyxfind.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index aae8b30bff..f72169ae66 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -240,7 +240,7 @@ int findForward(DocIterator & cur, DocIterator const endcur,
 		bool find_del = true, bool onlysel = false)
 {
 	for (; cur; cur.forwardChar()) {
-		if (onlysel && endcur.pit() == cur.pit()
+		if (onlysel && cur.inTexted() && endcur.pit() == cur.pit()
 		    && endcur.idx() == cur.idx() && endcur.pos() < cur.pos())
 			break;
 		if (cur.inTexted()) {
@@ -259,7 +259,7 @@ int findBackwards(DocIterator & cur, DocIterator const endcur,
 {
 	while (cur) {
 		cur.backwardChar();
-		if (onlysel && endcur.pit() == cur.pit()
+		if (onlysel && cur.inTexted() && endcur.pit() == cur.pit()
 		    && endcur.idx() == cur.idx() && endcur.pos() > cur.pos())
 			break;
 		if (cur.inTexted()) {


More information about the lyx-cvs mailing list