sw/source/core/undo/rolbck.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit be1addf9eb8e953e4ce4d0c30eca037d580fa7ac Author: Jim Raykowski <[email protected]> AuthorDate: Sat Dec 27 11:33:25 2025 -0900 Commit: Jim Raykowski <[email protected]> CommitDate: Wed Dec 31 04:56:46 2025 +0100 related tdf#167491: Prevent SwHistoryBookmark::SetInDoc crash Revealed by sort chapters undo redo of WG7617-Fields.odt Change-Id: Ic8bc9ed88293a524ff7dea6f865cd6a5d0642988 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196262 Tested-by: Jenkins Reviewed-by: Jim Raykowski <[email protected]> diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 7d10a2624ec0..f5ce46dfd8c7 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -683,15 +683,17 @@ void SwHistoryBookmark::SetInDoc( SwDoc& rDoc, bool ) if(m_bSavePos) { SwContentNode* const pContentNd = rNds[m_nNode]->GetContentNode(); - assert(pContentNd); - oPam.emplace(*pContentNd, m_nContent); + SAL_WARN_IF(!pContentNd, "sw.core", "expected a SwContentNode"); + if (pContentNd) + oPam.emplace(*pContentNd, m_nContent); } else { assert(pMark); oPam.emplace(pMark->GetMarkPos()); } - assert(oPam); + if (!oPam) + return; if(m_bSaveOtherPos) {
