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 32398232e9
"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 <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
László Németh 2024-11-30 03:34:57 +01:00
parent 34a63a22df
commit 20ee4ecfeb

View file

@ -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 ];