From 41db28dd45e64a63c5293c81e4469c2937b6242e Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Mon, 31 May 2010 23:20:30 +0000 Subject: [PATCH] Fix bug #6739: Loading in a 1.6.5 file causes 1.6.6-1 to crash git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34563 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/MathData.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index fe0be267a5..8a1a58b0a0 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -646,9 +646,17 @@ void MathData::attachMacroParameters(Cursor * cur, // found tail script? E.g. \foo{a}b^x if (scriptToPutAround.nucleus()) { + InsetMathScript * scriptInset = + scriptToPutAround.nucleus()->asScriptInset(); + // In the math parser we remove empty braces in the base + // of a script inset, but we have to restore them here. + if (scriptInset->nuc().empty()) { + MathData ar; + scriptInset->nuc().push_back( + MathAtom(new InsetMathBrace(ar))); + } // put macro into a script inset - scriptToPutAround.nucleus()->asScriptInset()->nuc()[0] - = operator[](macroPos); + scriptInset->nuc()[0] = operator[](macroPos); operator[](macroPos) = scriptToPutAround; // go into the script inset nucleus @@ -656,8 +664,7 @@ void MathData::attachMacroParameters(Cursor * cur, cur->append(0, 0); // get pointer to "deep" copied macro inset - InsetMathScript * scriptInset - = operator[](macroPos).nucleus()->asScriptInset(); + scriptInset = operator[](macroPos).nucleus()->asScriptInset(); macroInset = scriptInset->nuc()[0].nucleus()->asMacro(); } -- 2.39.5