diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-30 08:02:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-30 11:27:17 +0100 |
commit | e97e3ea3a2545a1b1d962eca95045b6da232f204 (patch) | |
tree | 5ebc17925fc2b68ab47d8137eeac605eafe80ee1 | |
parent | f7bb0a1fd6896df5b13b91f63f05296174764394 (diff) |
tdf#126788 fetch node index once here
Change-Id: I5991dda00879b55090a8353001ce341a2360fab2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142031
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/source/core/docnode/node.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/layout/tabfrm.cxx | 3 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index f15d069f3095..0ac601019a7e 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -307,12 +307,13 @@ SwNode::SwNode( const SwNode& rWhere, const SwNodeType nNdType ) #endif , m_pStartOfSection( nullptr ) { - if( !rWhere.GetIndex() ) + SwNodeOffset nWhereOffset = rWhere.GetIndex(); + if( !nWhereOffset ) return; SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes()); - SwNode* pNd = rNodes[ rWhere.GetIndex() -1 ]; - rNodes.InsertNode( this, rWhere.GetIndex() ); + SwNode* pNd = rNodes[ nWhereOffset -1 ]; + rNodes.InsertNode( this, nWhereOffset ); m_pStartOfSection = pNd->GetStartNode(); if( nullptr == m_pStartOfSection ) { diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 25213d481fa5..598dd4b08242 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -4953,9 +4953,8 @@ SwCellFrame::SwCellFrame(const SwTableBox &rBox, SwFrame* pSib, bool bInsertCont //If a StartIdx is available, ContentFrames are added in the cell, otherwise //Rows have to be present and those are added. - if ( rBox.GetSttIdx() ) + if ( SwNodeOffset nIndex = rBox.GetSttIdx() ) { - SwNodeOffset nIndex = rBox.GetSttIdx(); ::InsertCnt_( this, rBox.GetFrameFormat()->GetDoc(), ++nIndex ); } else |