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

New commits:
commit 6725491ce8ef2e41feb9b732ad7ac366ba545ca9
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Jun 26 12:15:19 2018 +0100

    forcepoint#48 null deref
    
    Change-Id: I790fc6dafc0d8c9783b9dddc266b313af2a046d7
    Reviewed-on: https://gerrit.libreoffice.org/56463
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

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));
         }
     }
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to