[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sw/source

Caolán McNamara caolanm at redhat.com
Tue Jun 26 19:40:12 UTC 2018


 sw/source/core/unocore/unoportenum.cxx |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

New commits:
commit 3e641f8f101e1064862972327d8562f4b0f756a1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 26 12:15:19 2018 +0100

    forcepoint#48 null deref
    
    Change-Id: I790fc6dafc0d8c9783b9dddc266b313af2a046d7
    Reviewed-on: https://gerrit.libreoffice.org/56461
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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()


More information about the Libreoffice-commits mailing list