sw/source/core/crsr/crstrvl.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 20ee4ecfeb1c504f0bc8a3057ff30e2e61f4b300
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Sat Nov 30 03:34:57 2024 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Sat Nov 30 18:37:33 2024 +0100

    tdf#164074 sw inline heading: clean-up outline moving
    
    Fix bad condition with ++std::npos in the following !WithChildren
    inline heading branch:
    
    else if( pOutlNdsInline && ++nEndPosInline < pOutlNdsInline->size() )
    
    The problem was reported by Caolán McNamara.
    
    Remove also an unused variable in docnum.cxx.
    
    Follow-up to commit 32398232e925d18d2ac5a6d467b61e1a84a0df7c
    "tdf#164074 sw inline heading: add up/down outline moving".
    
    Change-Id: I61d75451adeb13fe8e74ce586c4668a8caf0105b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177580
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 4af08af4c24d..910a62d05bbc 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1384,6 +1384,12 @@ void 
SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineN
     SwNode* pSttNd = rOutlNds[ nSttPos ];
     SwNode* pEndNd = rOutlNds[ nEndPos ];
 
+    if( pOutlNdsInline )
+    {
+        pSttNd = const_cast<SwNode*>(SwOutlineNodes::GetRootNode(pSttNd));
+        pOutlNdsInline->Seek_Entry( pEndNd, &nEndPosInline );
+    }
+
     if( bWithChildren && !pOutlNdsInline )
     {
         const int nLevel = pEndNd->GetTextNode()->GetAttrOutlineLevel()-1;
@@ -1399,10 +1405,6 @@ void 
SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineN
     else if( bWithChildren && pOutlNdsInline )
     {
         const int nLevel = pEndNd->GetTextNode()->GetAttrOutlineLevel() - 1;
-        pSttNd = const_cast<SwNode*>(SwOutlineNodes::GetRootNode(pSttNd));
-
-        pOutlNdsInline->Seek_Entry( pEndNd, &nEndPosInline );
-
         for( ++nEndPosInline; nEndPosInline < pOutlNdsInline->size(); 
++nEndPosInline )
         {
             pEndNd = (*pOutlNdsInline)[ nEndPosInline ];

Reply via email to