[LyX/master] Workaround for #11676

Juergen Spitzmueller spitz at lyx.org
Sun Dec 4 09:14:56 UTC 2022


commit 891ba7263ecdd0fec077e318f41009527a4ab513
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Dec 4 11:09:00 2022 +0100

    Workaround for #11676
    
    Avoid the crash we get with this combination. Having identified the real
    cause would of course have been better. But it seems no one has a clue.
---
 src/DocIterator.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp
index 7c1924c..94b7792 100644
--- a/src/DocIterator.cpp
+++ b/src/DocIterator.cpp
@@ -549,6 +549,11 @@ void DocIterator::updateInsets(Inset * inset)
 	size_t const n = slices_.size();
 	slices_.resize(0);
 	for (size_t i = 0 ; i < n; ++i) {
+		if (dit[i].empty() && prevMath().lyxCode() == MATH_SCRIPT_CODE)
+			// Workaround: With empty optional argument and a trailing script,
+			// we have empty slices in math macro args (#11676)
+			// FIXME: Find real cause!
+			continue;
 		LBUFERR(inset);
 		push_back(dit[i]);
 		top().inset_ = inset;


More information about the lyx-cvs mailing list