[LyX features/feature/docbook] DocBook: Coverity potential problem for precooked bibliographies.

Thibaut Cuvelier tcuvelier at lyx.org
Mon Aug 24 23:46:50 UTC 2020


The branch, feature/docbook, has been updated.

- Log -----------------------------------------------------------------

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

    DocBook: Coverity potential problem for precooked bibliographies.

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 114fee5..75b2ae4 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -384,9 +384,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 || ip->lyxCode() == BIBITEM_CODE)
+			continue;
+		if (const auto * bibitem = dynamic_cast<const InsetBibitem*>(ip)) {
 			attr = from_utf8("xml:id='") + bibitem->getParam("key") + from_utf8("'");
 			break;
 		}

-----------------------------------------------------------------------

Summary of changes:
 src/output_docbook.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list