[LyX/master] An assert to hopefully please coverity

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Oct 29 10:16:03 UTC 2021


commit 2c50f0cd77a96ccfeb48262e7144eadc39ee21f7
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Fri Oct 29 12:39:50 2021 +0200

    An assert to hopefully please coverity
---
 src/insets/InsetText.cpp |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 626818c..a452184 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -664,6 +664,8 @@ void InsetText::docbookRenderAsImage(XMLStream & xs, OutputParams const & rp, XH
 	// TODO: no real support for Unicode. This code is very similar to RenderPreview::addPreview, the same gotcha applies.
 
 	graphics::PreviewLoader* loader = buffer().loader();
+	// This should be OK because we are exporting
+	LASSERT(loader != nullptr, return);
 	loader->add(snippet);
 	loader->startLoading(true); // Generate the image and wait until done.
 	graphics::PreviewImage const * img = loader->preview(snippet);


More information about the lyx-cvs mailing list