[LyX/master] DocBook, InsetFloat: avoid a potential nullptr dereference when detecting the type of table for filler content.

Thibaut Cuvelier tcuvelier at lyx.org
Sun Feb 20 19:58:12 UTC 2022


commit cfb6f205fa59a7989958ac2808e5a3c62f1b35bf
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Feb 20 21:30:39 2022 +0100

    DocBook, InsetFloat: avoid a potential nullptr dereference when detecting the type of table for filler content.
---
 src/insets/InsetFloat.cpp |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index cb05e49..981d611 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -819,12 +819,15 @@ void docbookNoSubfigures(XMLStream & xs, OutputParams const & runparams, const I
 	}
 
 	// - Output the actual content of the float or some dummy content (to ensure that the output
-	// document is valid).
+	// document is valid). Use HTML tables by default, unless an InsetFloat is given.
 	if (hasFloat)
 		xs << XMLStream::ESCAPE_NONE << osFloatContent.str();
-	else if (ftype.docbookFloatType() == "table")
-		docbookGenerateFillerTable(xs, thisFloat->buffer().params().docbook_table_output);
-	else
+	else if (ftype.docbookFloatType() == "table") {
+		BufferParams::TableOutput tableFormat = BufferParams::HTMLTable;
+		if (thisFloat)
+			tableFormat = thisFloat->buffer().params().docbook_table_output;
+		docbookGenerateFillerTable(xs, tableFormat);
+	} else
 		docbookGenerateFillerMedia(xs);
 
 	// - Close the float.


More information about the lyx-cvs mailing list