summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-07-18 12:16:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-07-19 09:37:41 +0200
commit1692c206e582c42b50308b72509bf86874afaf73 (patch)
treedcd55459026b450eb5b3b2f8742c9dc793f269a3
parentabd13678a02a39110c6eef5ad55dcb97fce62ade (diff)
cid#704863 Dereference after null check
Change-Id: I472f48c64a6f2d13b124ede28a83dab3b46f759f Reviewed-on: https://gerrit.libreoffice.org/75915 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/doc/docbm.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index ef7812c6cb8e..883be228142e 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -681,7 +681,8 @@ namespace sw { namespace mark
if (bUndoIsEnabled)
{
m_pDoc->GetIDocumentUndoRedo().DoUndo(bUndoIsEnabled);
- m_pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsTextFieldmark>(*pFieldMark));
+ if (pFieldMark)
+ m_pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsTextFieldmark>(*pFieldMark));
}
return pFieldMark;
@@ -726,7 +727,8 @@ namespace sw { namespace mark
if (bUndoIsEnabled)
{
m_pDoc->GetIDocumentUndoRedo().DoUndo(bUndoIsEnabled);
- m_pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsNoTextFieldmark>(*pFieldMark));
+ if (pFieldMark)
+ m_pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsNoTextFieldmark>(*pFieldMark));
}
m_pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified);