diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-26 12:15:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-26 21:39:41 +0200 |
commit | 3e641f8f101e1064862972327d8562f4b0f756a1 (patch) | |
tree | d5e8e5647d682d8bf3a3be5f877c877f68dbb3a4 /sw/source/core/unocore | |
parent | ef32eff2fb9b4c00a1518b8cf4cae8433d564c61 (diff) |
forcepoint#48 null deref
Change-Id: I790fc6dafc0d8c9783b9dddc266b313af2a046d7
Reviewed-on: https://gerrit.libreoffice.org/56461
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 2506285ad866..85877cbdf81d 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -286,25 +286,27 @@ namespace ::sw::mark::AnnotationMark* const pAnnotationMark = dynamic_cast< ::sw::mark::AnnotationMark* >(ppMark->get()); - if ( pAnnotationMark == nullptr ) - { + if (!pAnnotationMark) continue; - } const SwPosition& rStartPos = pAnnotationMark->GetMarkStart(); - if ( rStartPos.nNode == nOwnNode ) + if (rStartPos.nNode != nOwnNode) + continue; + + const SwFormatField* pAnnotationFormatField = pAnnotationMark->GetAnnotationFormatField(); + if (!pAnnotationFormatField) { - const SwFormatField* pAnnotationFormatField = pAnnotationMark->GetAnnotationFormatField(); - assert(pAnnotationFormatField != nullptr); - rAnnotationStartArr.insert( - std::make_shared<SwAnnotationStartPortion_Impl>( - SwXTextField::CreateXTextField(&rDoc, - pAnnotationFormatField), - rStartPos)); + SAL_WARN("sw.core", "missing annotation format field"); + continue; } + + rAnnotationStartArr.insert( + std::make_shared<SwAnnotationStartPortion_Impl>( + SwXTextField::CreateXTextField(&rDoc, + pAnnotationFormatField), + rStartPos)); } } - } const uno::Sequence< sal_Int8 > & SwXTextPortionEnumeration::getUnoTunnelId() |