[LyX/master] Fix Coverity false positive for null-pointer dereference
Pavel Sanda
sanda at lyx.org
Thu Jul 9 07:00:48 UTC 2020
commit af5257b6c3b24c00b18c601b77033cf7e60ce211
Author: Thibaut Cuvelier <cuvelier.thibaut at gmail.com>
Date: Thu Jul 9 02:40:20 2020 +0200
Fix Coverity false positive for null-pointer dereference
---
src/output_docbook.cpp | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index f15c70a..a8ac4ea 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -946,16 +946,17 @@ void docbookParagraphs(Text const &text,
docstring id = docstring();
for (pos_type i = 0; i < par->size(); ++i) {
Inset const *inset = par->getInset(i);
- if (inset && dynamic_cast<InsetLabel const *>(inset)) {
- // Generate the attributes for the section if need be.
- auto label = dynamic_cast<InsetLabel const *>(inset);
- id += "xml:id=\"" + xml::cleanID(label->screenLabel()) + "\"";
+ if (inset) {
+ if (auto label = dynamic_cast<InsetLabel const *>(inset)) {
+ // Generate the attributes for the section if need be.
+ id += "xml:id=\"" + xml::cleanID(label->screenLabel()) + "\"";
- // Don't output the ID as a DocBook <anchor>.
- ourparams.docbook_anchors_to_ignore.emplace(label->screenLabel());
+ // Don't output the ID as a DocBook <anchor>.
+ ourparams.docbook_anchors_to_ignore.emplace(label->screenLabel());
- // Cannot have multiple IDs per tag.
- break;
+ // Cannot have multiple IDs per tag.
+ break;
+ }
}
}
More information about the lyx-cvs
mailing list