summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2022-08-25 21:53:06 +0200
committerIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2022-08-27 15:13:21 +0200
commit716f3e73fcedc4c4c107527a49aaec604a7e2c63 (patch)
tree0741bfb68785df5a9e93cd90cb832dbc7472a344
parent4b760d15067d96591dd351d1a8b3dd59251e1aa8 (diff)
tdf#150594 - Prevent crash while searching for the next outline node
Change-Id: Ia83968b26f0053815c0da9910aa00f9dde577246 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138850 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> (cherry picked from commit 33c6dcfaab35a70f8794a67d31fbec636cb485d5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138897 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
-rw-r--r--sw/source/core/doc/doctxm.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 83310172e852..9665c3915714 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -804,8 +804,9 @@ static bool IsHeadingContained(const SwTextNode* pChptrNd, const SwNode& rNd)
else
{
// Search for the next outline node which lies not within the current chapter node
- while (pChptrNd->GetAttrOutlineLevel()
- < rONds[nPos]->GetTextNode()->GetAttrOutlineLevel())
+ while (nPos > 0
+ && pChptrNd->GetAttrOutlineLevel()
+ < rONds[nPos]->GetTextNode()->GetAttrOutlineLevel())
nPos--;
bIsHeadingContained = pChptrNd == rONds[nPos]->GetTextNode();
}