sw/source/core/docnode/node.cxx | 8 ++++++++ 1 file changed, 8 insertions(+)
New commits: commit 282b3d5ba967e9a074ca71b27c933a6c0a44e101 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Mar 3 15:01:58 2025 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Mar 3 15:06:45 2025 +0100 sw: workaround crash when deleting textbox of shape ... that is positioned off-page. Crashes in SwNode::RemoveAnchoredFly because m_pAnchoredFlys is null, apparently the text frame was not registered at the node. This stops crashing in 7.1 with commit fd88bb81236ad6d1a63436b7ce20f2f93410d359 "tdf#107225 tdf#122887 sw: fix reanchoring of textboxes" but that is a fix for 2 other commits that aren't in this branch and has a follow-up later that fixes some problem it apparently introduced... For this old branch, use less risky approach of just ignoring the problem, which avoids crashing. Change-Id: If05fed24762400a3e3b8db23c3ce684c13b31b41 diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 0bf2729cd02c..5f2b77533516 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -2116,8 +2116,16 @@ void SwNode::RemoveAnchoredFly(SwFrameFormat *const pFlyFormat) // assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this); assert(IsTextNode() || IsStartNode() || IsTableNode()); assert(m_pAnchoredFlys); + if (!m_pAnchoredFlys) // problem was fixed in newer branches + { + return; + } auto it(std::find(m_pAnchoredFlys->begin(), m_pAnchoredFlys->end(), pFlyFormat)); assert(it != m_pAnchoredFlys->end()); + if (it == m_pAnchoredFlys->end()) // problem was fixed in newer branches + { + return; + } m_pAnchoredFlys->erase(it); if (m_pAnchoredFlys->empty()) {