]> git.lyx.org Git - lyx.git/blobdiff - src/output_latex.cpp
Fix crash after 24926b2e239.
[lyx.git] / src / output_latex.cpp
index 07490e5dfe90e524fb9feb5525c1883110dbf435..1185e2d6e343149dbb0e7eddbb740958c9bed6ea 100644 (file)
@@ -1593,6 +1593,8 @@ void latexParagraphs(Buffer const & buf,
        // lastpit is for the language check after the loop.
        pit_type lastpit = pit;
        // variables used in the loop:
+       bool was_title = false;
+       bool already_title = false;
        DocumentClass const & tclass = bparams.documentClass();
 
        // Did we already warn about inTitle layout mixing? (we only warn once)
@@ -1607,7 +1609,7 @@ void latexParagraphs(Buffer const & buf,
                                tclass.plainLayout() : par->layout();
 
                if (layout.intitle) {
-                       if (runparams.already_title) {
+                       if (already_title) {
                                if (!gave_layout_warning && !runparams.dryrun) {
                                        gave_layout_warning = true;
                                        frontend::Alert::warning(_("Error in latexParagraphs"),
@@ -1617,16 +1619,15 @@ void latexParagraphs(Buffer const & buf,
                                                          "could lead to missing or incorrect output."
                                                          ), layout.name()));
                                }
-                       } else if (!runparams.issued_title_cmd) {
-                               runparams.issued_title_cmd = true;
+                       } else if (!was_title) {
+                               was_title = true;
                                if (tclass.titletype() == TITLE_ENVIRONMENT) {
                                        os << "\\begin{"
                                                        << from_ascii(tclass.titlename())
                                                        << "}\n";
                                }
                        }
-               } else if (runparams.issued_title_cmd &&
-                                  !runparams.already_title && !layout.inpreamble) {
+               } else if (was_title && !already_title && !layout.inpreamble) {
                        if (tclass.titletype() == TITLE_ENVIRONMENT) {
                                os << "\\end{" << from_ascii(tclass.titlename())
                                                << "}\n";
@@ -1635,8 +1636,8 @@ void latexParagraphs(Buffer const & buf,
                                os << "\\" << from_ascii(tclass.titlename())
                                                << "\n";
                        }
-                       runparams.already_title = true;
-                       runparams.issued_title_cmd = false;
+                       already_title = true;
+                       was_title = false;
                }
 
                if (layout.isCommand() && !layout.latexname().empty()
@@ -1691,17 +1692,14 @@ void latexParagraphs(Buffer const & buf,
        // But if we're in a branch, this is not the end of
        // the document. (There may be some other checks of this
        // kind that are needed.)
-       if (runparams.issued_title_cmd &&
-                       !runparams.already_title && !runparams.inbranch) {
+       if (was_title && !already_title && !runparams.inbranch) {
                if (tclass.titletype() == TITLE_ENVIRONMENT) {
                        os << "\\end{" << from_ascii(tclass.titlename())
                           << "}\n";
-                       runparams.issued_title_cmd = false;
                } else {
                        os << "\\" << from_ascii(tclass.titlename())
                           << "\n";
                }
-               runparams.already_title = true;
        }
 
        if (maintext && !is_child && runparams.openbtUnit)