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 <raykowj@gmail.com>
This commit is contained in:
Jim Raykowski
2025-12-31 04:56:46 +01:00
parent 076ad399c2
commit be1addf9eb
+5 -3
View File
@@ -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)
{