diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-08-18 17:20:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-08-18 21:08:40 +0100 |
commit | 6d9953a4d951353b5f04acc0522a98ccb331d7ab (patch) | |
tree | 1c3a21ae9afa2d79081dc4fae59efdd128b583d5 /editeng | |
parent | coverity#1371377 Resource leak (diff) | |
download | core-6d9953a4d951353b5f04acc0522a98ccb331d7ab.tar.gz core-6d9953a4d951353b5f04acc0522a98ccb331d7ab.zip |
coverity#1371381 Dereference before null check
this ones in 5-2 also
Change-Id: Ia594fdc466d745df141b76ad7d8af3f362287766
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 4bb11e0de29f..2fabc4258180 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -1487,26 +1487,24 @@ void Outliner::SetRefDevice( OutputDevice* pRefDev ) void Outliner::ParaAttribsChanged( sal_Int32 nPara ) { - // The Outliner does not have an undo of its own, when paragraphs are // separated/merged. When ParagraphInserted the attribute EE_PARA_OUTLLEVEL // may not be set, this is however needed when the depth of the paragraph // is to be determined. - if( pEditEngine->IsInUndo() ) - { - if ( pParaList->GetParagraphCount() == pEditEngine->GetParagraphCount() ) - { - Paragraph* pPara = pParaList->GetParagraph( nPara ); - // tdf#100734: force update of bullet - pPara->Invalidate(); - const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ) ); - if ( pPara && pPara->GetDepth() != rLevel.GetValue() ) - { - pPara->SetDepth( rLevel.GetValue() ); - ImplCalcBulletText( nPara, true, true ); - } - } - } + if (!pEditEngine->IsInUndo()) + return; + if (pParaList->GetParagraphCount() != pEditEngine->GetParagraphCount()) + return; + Paragraph* pPara = pParaList->GetParagraph(nPara); + if (!pPara) + return; + // tdf#100734: force update of bullet + pPara->Invalidate(); + const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ) ); + if (pPara->GetDepth() == rLevel.GetValue()) + return; + pPara->SetDepth(rLevel.GetValue()); + ImplCalcBulletText(nPara, true, true); } void Outliner::StyleSheetChanged( SfxStyleSheet* pStyle ) |