summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2022-08-25 21:53:06 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2022-08-25 23:01:08 +0200
commit33c6dcfaab35a70f8794a67d31fbec636cb485d5 (patch)
treeb472223277b27cd1cf7a8b149006426ea91b7be7 /sw
parent84629220ad7d7897f57070b4aba6a3cbaef756aa (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>
Diffstat (limited to 'sw')
-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 bdea1e4dec1d..ee418e5f1d4e 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();
}