[LyX/master] Amend 16e67d4e

Enrico Forestieri forenr at lyx.org
Fri Jan 27 19:11:10 UTC 2023


commit 07150cd9286308c893d77cd7748d237544f94225
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Fri Jan 27 21:10:02 2023 +0100

    Amend 16e67d4e
    
    A docstring is not 0-terminated...
---
 src/mathed/InsetMathMacro.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index aba4ab7..a90bf87 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -991,7 +991,8 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const
 				// Avoid recursion on a recursive macro definition
 				docstring const & def = data->definition();
 				int pos = tokenPos(def, '\\', name());
-				char_type c = def.at(pos + name().size());
+				char_type c = pos + name().size() < def.size()
+					      ? def.at(pos + name().size()) : 0;
 				if (pos < 0 || (name().size() > 1 &&
 						((c >= 'a' && c <= 'z') ||
 						 (c >= 'A' && c <= 'Z')))) {


More information about the lyx-cvs mailing list