summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-08-25 14:22:43 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2023-08-30 15:46:23 +0200
commit68e9aa4f162f3fd930f472a4a1e3c0b66b9a781e (patch)
treef5f25221f96865f13c6e9780bfe118562adc974a
parent358c3d707f9a76130e68f8288ec2504f14f47c83 (diff)
editeng: fix crash in EditDoc::FindAttribs
check pNode before calling EditDoc::FindAttribs. This is the only place where EditDoc::FindAttribs is called from See https://crashreport.libreoffice.org/stats/signature/EditDoc::FindAttribs(ContentNode%20*,long,long,SfxItemSet%20&) Change-Id: I3ed0724b1113965c09c66413987bb85777ec9a16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156097 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 8bb505d3e16deed2c7bb5636cfd765013ec23965) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156213 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--editeng/source/editeng/impedit5.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 9a02ca4c4557..92b4d7afffe8 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -316,7 +316,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, EditEngineAttribs nOnl
for ( sal_Int32 nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
ContentNode* pNode = aEditDoc.GetObject( nNode );
- DBG_ASSERT( aEditDoc.GetObject( nNode ), "Node not found: GetAttrib" );
+ assert( pNode && "Node not found: GetAttrib" );
const sal_Int32 nStartPos = nNode==nStartNode ? aSel.Min().GetIndex() : 0;
const sal_Int32 nEndPos = nNode==nEndNode ? aSel.Max().GetIndex() : pNode->Len(); // Can also be == nStart!
@@ -327,7 +327,8 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, EditEngineAttribs nOnl
// 2) Examine Style and paragraph attributes only when OFF...
// First the very hard formatting...
- EditDoc::FindAttribs( pNode, nStartPos, nEndPos, aCurSet );
+ if (pNode)
+ EditDoc::FindAttribs( pNode, nStartPos, nEndPos, aCurSet );
if( nOnlyHardAttrib != EditEngineAttribs::OnlyHard )
{