diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-26 17:08:54 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-26 18:01:32 +0200 |
commit | 2013d184f1cf5928fa4a919d1521c1ae7b053796 (patch) | |
tree | fb909d32a34e25bda38e96f1dea9b546810ba393 /sw | |
parent | 785dd5a3a79383d86d1b5de4f1d7acdf3913322d (diff) |
coverity#1158084 Unchecked dynamic_cast
Change-Id: Ia800e45166b0206377fa9e138c4e444e476e3863
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index dc5473458a81..5aa68f10dedb 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1906,19 +1906,25 @@ void _RestoreCntntIdx(std::vector<sal_uLong> &rSaveArr, case 0x8000: { MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getAllMarksBegin()[aSave.GetCount()].get()); - SwPosition aNewPos(pMark->GetMarkPos()); - aNewPos.nNode = rNd; - aNewPos.nContent.Assign(pCNd, std::min(aSave.GetContent(), nLen)); - pMark->SetMarkPos(aNewPos); + if (pMark) + { + SwPosition aNewPos(pMark->GetMarkPos()); + aNewPos.nNode = rNd; + aNewPos.nContent.Assign(pCNd, std::min(aSave.GetContent(), nLen)); + pMark->SetMarkPos(aNewPos); + } } break; case 0x8001: { MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getAllMarksBegin()[aSave.GetCount()].get()); - SwPosition aNewPos(pMark->GetOtherMarkPos()); - aNewPos.nNode = rNd; - aNewPos.nContent.Assign(pCNd, std::min(aSave.GetContent(), nLen)); - pMark->SetOtherMarkPos(aNewPos); + if (pMark) + { + SwPosition aNewPos(pMark->GetOtherMarkPos()); + aNewPos.nNode = rNd; + aNewPos.nContent.Assign(pCNd, std::min(aSave.GetContent(), nLen)); + pMark->SetOtherMarkPos(aNewPos); + } } break; case 0x1001: |