]> git.lyx.org Git - features.git/blobdiff - src/output_latex.cpp
Do not try to pop from an empty stack
[features.git] / src / output_latex.cpp
index ac22116976d7cf8cbb08b0b7ed91802637dc1a78..f6c7375c90a7513df16591c209cadad590131d50 100644 (file)
@@ -607,6 +607,14 @@ void popLanguageName()
 }
 
 
+bool languageStackEmpty()
+{
+       OutputState * state = getOutputState();
+
+       return state->lang_switch_depth_.empty();
+}
+
+
 string const & openLanguageName()
 {
        OutputState * state = getOutputState();
@@ -1768,7 +1776,7 @@ void latexParagraphs(Buffer const & buf,
                        << '\n';
                // If we have language_auto_begin, the stack will
                // already be empty, nothing to pop()
-               if (using_begin_end && !lyxrc.language_auto_begin)
+               if (using_begin_end && langOpenedAtThisLevel(state))
                        popLanguageName();
        }