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

Thibaut Cuvelier tcuvelier at lyx.org
Mon Aug 24 23:49:11 UTC 2020


The branch, feature/docbook, has been updated.
  discards  736606a4c0230b97810d47ceb5729258b68dcdcf (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (736606a4c0230b97810d47ceb5729258b68dcdcf)
            \
             N -- N -- N (e433f1beecd074788c0207cc6e9a96f9b417193d)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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

commit e433f1beecd074788c0207cc6e9a96f9b417193d
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..6e52eac 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)
+			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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list