summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-16 16:50:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-11-16 18:51:06 +0100
commit32c39e510aba585fd6675e3497e158efab74b8a4 (patch)
treef3bfe6195a4b489e3d7746a14edcbbcb17dc9bae /sw
parenta6dfb4164dbb808ec4b5752e05c8f22655d1757a (diff)
cid#1448525 Dereference null return value
Change-Id: I0dae9e73e85cef74f041535f3787e3afb45bb94d Reviewed-on: https://gerrit.libreoffice.org/82989 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/undo/SwUndoTOXChange.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/sw/source/core/undo/SwUndoTOXChange.cxx b/sw/source/core/undo/SwUndoTOXChange.cxx
index 4296aa23d35f..c88182b7a522 100644
--- a/sw/source/core/undo/SwUndoTOXChange.cxx
+++ b/sw/source/core/undo/SwUndoTOXChange.cxx
@@ -24,12 +24,22 @@
#include <doc.hxx>
#include <node.hxx>
+namespace
+{
+ sal_uLong GetSectionNodeIndex(SwTOXBaseSection const& rTOX)
+ {
+ const SwSectionNode* pSectNd = rTOX.GetFormat()->GetSectionNode();
+ assert(pSectNd);
+ return pSectNd->GetIndex();
+ }
+}
+
SwUndoTOXChange::SwUndoTOXChange(const SwDoc *pDoc,
SwTOXBaseSection const& rTOX, SwTOXBase const& rNew)
: SwUndo(SwUndoId::TOXCHANGE, pDoc)
, m_Old(rTOX)
, m_New(rNew)
- , m_nNodeIndex(rTOX.GetFormat()->GetSectionNode()->GetIndex())
+ , m_nNodeIndex(GetSectionNodeIndex(rTOX))
{
}