summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-02-16 12:41:19 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-02-16 09:11:54 +0100
commit88192717f9e311dc810e472aec5fcdd50c922c35 (patch)
tree7e0c97e7cbf286594215f671d7b9cc637f49b20f
parent512b09ec51cfbe9bb0ce1a7f229b443dc427f6f3 (diff)
Simplify a bit
Change-Id: I31b31b112433ef7b5b75ff300d7ecf92f3fbcc03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163472 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sw/source/core/docnode/ndsect.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 856447d4d8d2..bd58372d38ac 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -965,12 +965,9 @@ SwSectionNode* SwNodes::InsertTextSection(SwNode& rNd,
SwSectionNode* SwNode::FindSectionNode()
{
- if( IsSectionNode() )
- return GetSectionNode();
- SwStartNode* pTmp = m_pStartOfSection;
- while( !pTmp->IsSectionNode() && pTmp->GetIndex() )
- pTmp = pTmp->m_pStartOfSection;
- return pTmp->GetSectionNode();
+ for (SwNode* tmp = this;; tmp = tmp->StartOfSectionNode())
+ if (SwSectionNode* sectNode = tmp->GetSectionNode(); sectNode || !tmp->GetIndex())
+ return sectNode;
}
// SwSectionNode