]> git.lyx.org Git - features.git/blobdiff - src/Paragraph.cpp
Do not try to pop from an empty stack
[features.git] / src / Paragraph.cpp
index 17c68fa98b422018eae4640164c624dfab987ab3..a08f3ac0074ec613bac5e691a4f4c7fa2eb45753 100644 (file)
@@ -2539,10 +2539,9 @@ void Paragraph::latex(BufferParams const & bparams,
        pos_type body_pos = beginOfBody();
        unsigned int column = 0;
 
-       // If we are inside an non inheritFont() inset, the real outerfont is local_font
-       Font const real_outerfont = (!inInset().inheritFont()
-                                    && runparams.local_font != nullptr)
-                       ? Font(runparams.local_font->fontInfo()) : outerfont;
+       // If we are inside an non inheritFont() inset, the outerfont is the default font
+       Font const real_outerfont =
+               inInset().inheritFont() ? outerfont : Font(bparams.documentClass().defaultfont());
 
        if (body_pos > 0) {
                // the optional argument is kept in curly brackets in
@@ -2806,7 +2805,8 @@ void Paragraph::latex(BufferParams const & bparams,
                        string end_tag = subst(lang_end_command, "$$lang", running_lang);
                        os << from_ascii(end_tag);
                        column += end_tag.length();
-                       popLanguageName();
+                       if (!languageStackEmpty())
+                               popLanguageName();
                }
 
                // Switch file encoding if necessary (and allowed)
@@ -4120,18 +4120,6 @@ bool Paragraph::needsCProtection(bool const fragile) const
                        continue;
                if (ins->needsCProtection(maintext, fragile))
                        return true;
-               // Now check math environments
-               InsetMath const * im = ins->asInsetMath();
-               if (!im || im->cell(0).empty())
-                       continue;
-               switch(im->cell(0)[0]->lyxCode()) {
-               case MATH_ENV_CODE:
-               case MATH_XYMATRIX_CODE:
-                       // these need cprotection
-                       return true;
-               default:
-                       break;
-               }
        }
 
        return false;