diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-11 18:23:25 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-11 18:46:41 +0200 |
commit | b05778b9c0e21e3b8fd9d8baa03864e6f0b9b407 (patch) | |
tree | df2c200f6d07b026cd6f0ba2104047920a243531 /sw | |
parent | 01a4dba8e9a43791d4f472d6c473398aee5034fe (diff) |
coverity#704860 Unchecked dynamic_cast
Change-Id: I4a6cf43eaf9626bdb1d486476d3e797fcab5ab13
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 8da3bb1402c8..45a00d66cb26 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -541,9 +541,12 @@ namespace sw { namespace mark return true; if ( findMark(rNewName) != m_vAllMarks.end() ) return false; - m_aMarkNamesSet.erase(dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)->GetName()); - m_aMarkNamesSet.insert(rNewName); - dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)->SetName(rNewName); + if (::sw::mark::MarkBase* pMarkBase = dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)) + { + m_aMarkNamesSet.erase(pMarkBase->GetName()); + m_aMarkNamesSet.insert(rNewName); + pMarkBase->SetName(rNewName); + } return true; } |