[LyX/master] DocBook: Kornel's patch to get rid of many assertions

Thibaut Cuvelier tcuvelier at lyx.org
Thu Jul 30 21:22:56 UTC 2020


commit e153477bcac8210547a43c49275d136e02c4a6f6
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Thu Jul 30 23:22:41 2020 +0200

    DocBook: Kornel's patch to get rid of many assertions
---
 src/output_docbook.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 75c160d..33d9910 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -342,7 +342,8 @@ ParagraphList::const_iterator makeParagraphBibliography(
 		// Don't forget the citation ID!
 		docstring attr;
 		for (auto i = 0; i < par->size(); ++i) {
-			if (par->getInset(0)->lyxCode() == BIBITEM_CODE) {
+			Inset const *ip = par->getInset(0);
+			if (ip != nullptr && ip->lyxCode() == BIBITEM_CODE) {
 				const auto * bibitem = dynamic_cast<const InsetBibitem*>(par->getInset(i));
 				attr = from_utf8("xml:id='") + bibitem->bibLabel() + from_utf8("'");
 				break;
@@ -417,7 +418,7 @@ ParagraphList::const_iterator makeParagraphs(
 			Inset const * firstInset = par->getInset(0);
 
 			// Floats cannot be in paragraphs.
-			special_case = to_ascii(firstInset->layoutName()).substr(0, 6) == "Float:";
+			special_case = to_utf8(firstInset->layoutName()).substr(0, 6) == "Float:";
 
 			// Bibliographies cannot be in paragraphs.
 			if (!special_case && firstInset->asInsetCommand())


More information about the lyx-cvs mailing list