diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-26 12:15:19 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2018-07-10 20:01:14 +0200 |
commit | 6725491ce8ef2e41feb9b732ad7ac366ba545ca9 (patch) | |
tree | 02b3cdde9a301466ad920f99f5010b632d15cb36 | |
parent | 44f72ca3747deb1c8824626f216d295815b5ceff (diff) |
forcepoint#48 null deref
Change-Id: I790fc6dafc0d8c9783b9dddc266b313af2a046d7
Reviewed-on: https://gerrit.libreoffice.org/56463
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index d40ec5bf5135..043fb179d0fa 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -288,22 +288,25 @@ 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)); } } } |