From 3d348818e083ceb531d916be01ef2db99392f9c3 Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Tue, 25 Aug 2020 02:11:08 +0200 Subject: [PATCH] DocBook: Coverity potential problem for precooked bibliographies. --- src/output_docbook.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index 3f6a69287b..4e6c30e545 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(par->getInset(i)); + Inset const *ip = par->getInset(i); + if (!ip) + continue; + if (const auto * bibitem = dynamic_cast(ip)) { attr = from_utf8("xml:id='") + bibitem->getParam("key") + from_utf8("'"); break; }