summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-02-06 12:34:26 +0000
committerMichael Stahl <Michael.Stahl@cib.de>2019-08-05 14:54:48 +0200
commitf4a3fa5392d147864b111459870ffde975efbd1d (patch)
treeb0f7504466f8deaa21208416185fdd5da5668b6b
parentcaefe6ede9cefa7a8f523a2347474554588edd17 (diff)
Resolves: tdf#123163 avoid null deref
one RemoveDrawObjFromPage is already null-deref protected, do the same for the other Change-Id: Ica5bb2df4a8dbffd8397df76b673adab75bb7aef Reviewed-on: https://gerrit.libreoffice.org/67457 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> (cherry picked from commit e6e8f02407ea781a3634fd2669ad6467e9587db4)
-rw-r--r--sw/source/core/layout/frmtool.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 61a9162ff5b8..aa745e6fc204 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2397,7 +2397,8 @@ static void lcl_RemoveObjsFromPage( SwFrame* _pFrame )
{
if (pObj->GetFrameFormat().GetAnchor().GetAnchorId() != FLY_AS_CHAR)
{
- pObj->GetPageFrame()->RemoveDrawObjFromPage(
+ if (SwPageFrame *pPg = pObj->GetPageFrame())
+ pPg->RemoveDrawObjFromPage(
*(static_cast<SwAnchoredDrawObject*>(pObj)) );
}
}
@@ -2737,8 +2738,8 @@ static void lcl_Regist( SwPageFrame *pPage, const SwFrame *pAnch )
if ( pPage != pObj->GetPageFrame() )
{
// #i28701#
- if ( pObj->GetPageFrame() )
- pObj->GetPageFrame()->RemoveDrawObjFromPage( *pObj );
+ if (SwPageFrame *pPg = pObj->GetPageFrame())
+ pPg->RemoveDrawObjFromPage( *pObj );
pPage->AppendDrawObjToPage( *pObj );
}
}