[LyX/master] DocBook: Coverity potential problem for precooked bibliographies.

Thibaut Cuvelier tcuvelier at lyx.org
Sat Sep 19 18:18:55 UTC 2020


commit 3d348818e083ceb531d916be01ef2db99392f9c3
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Tue Aug 25 02:11:08 2020 +0200

    DocBook: Coverity potential problem for precooked bibliographies.
---
 src/output_docbook.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 3f6a692..4e6c30e 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -386,9 +386,10 @@ void makeParagraphBibliography(
 	// Don't forget the citation ID!
 	docstring attr;
 	for (auto i = 0; i < par->size(); ++i) {
-		Inset const *ip = par->getInset(0);
-		if (ip != nullptr && ip->lyxCode() == BIBITEM_CODE) {
-			const auto * bibitem = dynamic_cast<const InsetBibitem*>(par->getInset(i));
+		Inset const *ip = par->getInset(i);
+		if (!ip)
+			continue;
+		if (const auto * bibitem = dynamic_cast<const InsetBibitem*>(ip)) {
 			attr = from_utf8("xml:id='") + bibitem->getParam("key") + from_utf8("'");
 			break;
 		}


More information about the lyx-cvs mailing list