[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 2 15:46:13 UTC 2020


 sw/source/core/unocore/unoobj2.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 2e2b97f0c919afffb262bfed7058c91264c3107c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 2 12:07:48 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 2 16:45:17 2020 +0100

    cid#1470356 silence Dereference null return value
    
    Change-Id: I3df9ce0695531714236025a041c1f4cd46cf7d1d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107067
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 4852fcca9662..eb73fa0f1e80 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -810,14 +810,15 @@ void SwXTextRange::DeleteAndInsert(
 
     if (RANGE_IS_SECTION == m_pImpl->m_eRangePosition)
     {
-        SwSectionFormat const* pFormat(
-            static_cast<SwSectionFormat const*>(m_pImpl->m_pTableOrSectionFormat));
-        if (!pFormat)
+        SwSectionNode const* pSectionNode = m_pImpl->m_pTableOrSectionFormat ?
+            static_cast<SwSectionFormat const*>(m_pImpl->m_pTableOrSectionFormat)->GetSectionNode() :
+            nullptr;
+        if (!pSectionNode)
         {
             throw uno::RuntimeException("disposed?");
         }
         m_pImpl->m_rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
-        SwNodeIndex const start(*pFormat->GetSectionNode());
+        SwNodeIndex const start(*pSectionNode);
         SwNodeIndex const end(*start.GetNode().EndOfSectionNode());
 
         // delete tables at start


More information about the Libreoffice-commits mailing list