sw/source/core/edit/edsect.cxx | 6 +++--- sw/source/core/undo/unattr.cxx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
New commits: commit 1d3efa2ada37940200f3eed298c9f859a592ae77 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat Aug 9 16:06:16 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sat Aug 9 22:02:21 2025 +0200 cid#1660804 Dereference null return value Change-Id: Ib53ec6473809dc99ada574827a378a0ab7b664d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189264 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index d54b37e7c999..d96f8ad4649d 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -404,7 +404,7 @@ void SwUndoFormatAttr::SaveFlyAnchor( const SwFormat * pFormat, bool bSvDrwPt ) { // Format is valid, otherwise you would not reach this point here if( bSvDrwPt ) { - if ( RES_DRAWFRMFMT == pFormat->Which() ) { + if (pFormat && RES_DRAWFRMFMT == pFormat->Which()) { Point aPt( static_cast<const SwFrameFormat*>(pFormat)->FindSdrObject() ->GetRelativePos() ); // store old value as attribute, to keep SwUndoFormatAttr small commit 39f512b4e384b39730a637392ff48897eee21331 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat Aug 9 16:04:38 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sat Aug 9 22:02:09 2025 +0200 cid#1660818 Dereference null return value Change-Id: Iee0004db9ad48e8753c5570fe6c8ebc31b98fd1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189263 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index f5af17b48933..49698290666d 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -338,7 +338,7 @@ static const SwNode* lcl_SpecialInsertNode(const SwPosition* pCurrentPos) } if(pInnermostNode != nullptr) { - bool bIsProtected = pInnermostNode->IsProtect(); + bool bCanModify = !pInnermostNode->IsProtect(); //special case - ToxSection // - in this case the inner section could be tox header @@ -354,7 +354,7 @@ static const SwNode* lcl_SpecialInsertNode(const SwPosition* pCurrentPos) if (const SwSection* pSectionParent = pSection->GetParent()) pInnermostNode = pSectionParent->GetFormat()->GetSectionNode(); } - bIsProtected = static_cast<const SwSectionNode*>(pInnermostNode)->IsInProtectSect(); + bCanModify = pInnermostNode && !static_cast<const SwSectionNode*>(pInnermostNode)->IsInProtectSect(); } // The previous version had a check to skip empty read-only sections. Those @@ -362,7 +362,7 @@ static const SwNode* lcl_SpecialInsertNode(const SwPosition* pCurrentPos) // inside a protected area. // Now, pInnermostNode is NULL or the innermost section or table node. - if(!bIsProtected) + if (bCanModify) { OSL_ENSURE( pInnermostNode->IsTableNode() || pInnermostNode->IsSectionNode(), "wrong node found" );