[LyX/master] docbook exports: Omit crashing export on some files

Kornel Benko kornel at lyx.org
Fri Aug 14 10:08:28 UTC 2020


commit 9b7db1190120de5031efd785b4607bd900418cbb
Author: Kornel Benko <kornel at lyx.org>
Date:   Fri Aug 14 12:31:25 2020 +0200

    docbook exports: Omit crashing export on some files
    
    Committed since Thibaut apparently has no time to react, and the crash is
    really distracting.
---
 src/insets/InsetNewline.cpp |   12 ++++++++++--
 src/xml.h                   |    2 ++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp
index 05c6ee4..45d52b2 100644
--- a/src/insets/InsetNewline.cpp
+++ b/src/insets/InsetNewline.cpp
@@ -176,8 +176,16 @@ void InsetNewline::docbook(XMLStream & xs, OutputParams const & runparams) const
 {
 	if (runparams.docbook_in_par) {
 		xs.closeFontTags();
-		xs << xml::EndTag("para");
-		xs << xml::StartTag("para");
+		if (!xs.pending_tags_empty()) {
+			xs << xml::EndTag("para");
+			xs << xml::StartTag("para");
+		}
+		else {
+			xs << xml::CR() << xml::CompTag("br") << xml::CR();
+		}
+	}
+	else {
+		xs << xml::CR() << xml::CompTag("br") << xml::CR();
 	}
 }
 
diff --git a/src/xml.h b/src/xml.h
index 12e7f25..b585a48 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -126,6 +126,8 @@ private:
 	TagDeque pending_tags_;
 	///
 	TagDeque tag_stack_;
+public:
+	bool pending_tags_empty() { return pending_tags_.empty();};
 };
 
 namespace xml {


More information about the lyx-cvs mailing list