[LyX/master] Amend c2facb8c

Enrico Forestieri forenr at lyx.org
Mon Mar 1 09:04:48 UTC 2021


commit bb2c1c3485b0da4f2463c18caecc42975e8d8dfb
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Mon Mar 1 10:08:08 2021 +0100

    Amend c2facb8c
    
    Make sure the base of a script is not empty before accessing it.
---
 src/Cursor.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index 6412c0e..ad46e8c 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -2041,7 +2041,7 @@ bool Cursor::mathForward(bool word)
 				while (pos() < lastpos() && mc == nextMath().mathClass());
 		} else if (openable(nextAtom())) {
 			InsetMathScript const * n = nextMath().asScriptInset();
-			bool to_brace_deco = n
+			bool to_brace_deco = n && !n->nuc().empty()
 				&& n->nuc().back()->lyxCode() == MATH_DECORATION_CODE
 				&& n->nuc().back()->mathClass() == MC_OP;
 			// single step: try to enter the next inset
@@ -2095,7 +2095,7 @@ bool Cursor::mathBackward(bool word)
 			}
 		} else if (openable(prevAtom())) {
 			InsetMathScript const * p = prevMath().asScriptInset();
-			bool to_brace_deco = p
+			bool to_brace_deco = p && !p->nuc().empty()
 				&& p->nuc().back()->lyxCode() == MATH_DECORATION_CODE
 				&& p->nuc().back()->mathClass() == MC_OP;
 			// single step: try to enter the preceding inset


More information about the lyx-cvs mailing list