diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-07-24 13:16:35 -0400 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2019-12-22 16:23:44 +0100 |
commit | 2f8b3ef21cb66470c2774a5dc0cccbaf7d22681c (patch) | |
tree | 53d9108d67babfe1c6c581a76cec10620fd05e3b /editeng | |
parent | 11efaea763bbbb9016ab39d53e191381444791f9 (diff) |
editeng: detect invalid paragraphs when drawing
This prevents live-lock (endless loop) in case
the paragraphs are invalid.
Change-Id: I77cc7818dabc8e518bd7ca3f5161d46ba3fe50b4
(cherry picked from commit deab77cb71c01171d0f8284339627ed33798c3a1)
Reviewed-on: https://gerrit.libreoffice.org/85002
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
(cherry picked from commit 3592d49eff0d063b26250ce32eea138af3108b79)
Reviewed-on: https://gerrit.libreoffice.org/85678
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 2c398703bc74..6107f950608a 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -272,8 +272,10 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion, ContentNode* pStartNode = aTmpSel.Min().GetNode(); ContentNode* pEndNode = aTmpSel.Max().GetNode(); - sal_Int32 nStartPara = pEditEngine->GetEditDoc().GetPos( pStartNode ); - sal_Int32 nEndPara = pEditEngine->GetEditDoc().GetPos( pEndNode ); + const sal_Int32 nStartPara = pEditEngine->GetEditDoc().GetPos(pStartNode); + const sal_Int32 nEndPara = pEditEngine->GetEditDoc().GetPos(pEndNode); + if (nStartPara == EE_PARA_NOT_FOUND || nEndPara == EE_PARA_NOT_FOUND) + return; for ( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { ParaPortion* pTmpPortion = pEditEngine->GetParaPortions().SafeGetObject( nPara ); |