sw/source/core/docnode/node.cxx  |    7 ++++---
 sw/source/core/layout/tabfrm.cxx |    3 +--
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit e97e3ea3a2545a1b1d962eca95045b6da232f204
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sun Oct 30 08:02:02 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Oct 30 11:27:17 2022 +0100

    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.gran...@collabora.co.uk>

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

Reply via email to