Author: forenr
Date: Tue Jun  1 01:20:30 2010
New Revision: 34563
URL: http://www.lyx.org/trac/changeset/34563

Log:
Fix bug #6739: Loading in a 1.6.5 file causes 1.6.6-1 to crash

Modified:
   lyx-devel/trunk/src/mathed/MathData.cpp

Modified: lyx-devel/trunk/src/mathed/MathData.cpp
==============================================================================
--- lyx-devel/trunk/src/mathed/MathData.cpp     Tue Jun  1 01:12:07 2010        
(r34562)
+++ lyx-devel/trunk/src/mathed/MathData.cpp     Tue Jun  1 01:20:30 2010        
(r34563)
@@ -646,9 +646,17 @@
 
        // 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 @@
                        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();        
        }
 

Reply via email to