sw/source/core/crsr/crstrvl.cxx | 5 ++++- sw/source/ui/index/swuiidxmrk.cxx | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
New commits: commit 36f232e27616f267577851c38a24c2a5c3caad90 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Jan 11 19:27:47 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Jan 11 20:34:01 2024 +0100 tdf#158783 sw: add some asserts for calling SelectTextAttr() ... ... with mismatched point node and SwTextAttr. Unfortunately SwTextAttr doesn't have a member that points to the node, just half of its subclasses do... Change-Id: I78193ac47a9287f01b236b71934053299d0ffb23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161928 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 1ca95f7ef0e9..41437f04b84c 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -2218,6 +2218,7 @@ bool SwCursorShell::SelectTextModel( const sal_Int32 nStart, SwCursorSaveState aSaveState( *m_pCurrentCursor ); SwPosition& rPos = *m_pCurrentCursor->GetPoint(); + assert(nEnd <= rPos.GetNode().GetTextNode()->Len()); m_pCurrentCursor->DeleteMark(); rPos.SetContent(nStart); m_pCurrentCursor->SetMark(); @@ -2292,7 +2293,9 @@ bool SwCursorShell::SelectTextAttr( sal_uInt16 nWhich, return false; const sal_Int32* pEnd = pTextAttr->End(); - bool bRet = SelectTextModel(pTextAttr->GetStart(), (pEnd ? *pEnd : pTextAttr->GetStart() + 1)); + sal_Int32 const nEnd(pEnd ? *pEnd : pTextAttr->GetStart() + 1); + assert(nEnd <= m_pCurrentCursor->GetPoint()->GetNode().GetTextNode()->Len()); + bool bRet = SelectTextModel(pTextAttr->GetStart(), nEnd); return bRet; } diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 39443f7e7b04..a0a8a2f93c0c 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -923,6 +923,7 @@ void SwIndexMarkPane::UpdateDialog() m_xKey1DCB->set_sensitive(bEnable); m_xKey2DCB->set_sensitive(bEnable); + assert(pMark->GetTextTOXMark()->GetTextNode() == m_pSh->GetCursor_()->GetPoint()->GetNode()); m_pSh->SelectTextAttr( RES_TXTATR_TOXMARK, pMark->GetTextTOXMark() ); // we need the point at the start of the attribute m_pSh->SwapPam();