DocBook: Coverity potential problem for precooked bibliographies.

This commit is contained in:
Thibaut Cuvelier 2020-08-25 02:11:08 +02:00
parent ac46456b28
commit 3d348818e0

View File

@ -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;
}