sw/source/uibase/utlui/content.cxx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
New commits: commit ba0a713fe76da5ee40ad34b375d3a900bff4e01a Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Wed May 25 23:17:02 2022 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Fri May 27 09:06:47 2022 +0200 tdf#149268 avoid null pointer dereference Change-Id: Iff3aece9eaed40c31764616504f1a4229db57e01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134978 Tested-by: Jenkins Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Jim Raykowski <rayk...@gmail.com> diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 91ce874b1553..584b80dfe0c5 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -651,15 +651,13 @@ void SwContentType::FillMemberList(bool* pbContentChanged) SwPosition bPos(bTextNode, b->GetStart()); // use anchor position for entries that are located in flys if (nEndOfExtrasIndex >= aTextNode.GetIndex()) - { if (auto pFlyFormat = aTextNode.GetFlyFormat()) - aPos = *pFlyFormat->GetAnchor().GetContentAnchor(); - } + if (const SwPosition* pPos = pFlyFormat->GetAnchor().GetContentAnchor()) + aPos = *pPos; if (nEndOfExtrasIndex >= bTextNode.GetIndex()) - { if (auto pFlyFormat = bTextNode.GetFlyFormat()) - bPos = *pFlyFormat->GetAnchor().GetContentAnchor(); - } + if (const SwPosition* pPos = pFlyFormat->GetAnchor().GetContentAnchor()) + bPos = *pPos; return aPos < bPos;}); } } @@ -856,15 +854,13 @@ void SwContentType::FillMemberList(bool* pbContentChanged) SwPosition bPos(const_cast<SwTextNode&>(bTextNode), b->rINetAttr.GetStart()); // use anchor position for entries that are located in flys if (nEndOfExtrasIndex >= aTextNode.GetIndex()) - { if (auto pFlyFormat = aTextNode.GetFlyFormat()) - aPos = *pFlyFormat->GetAnchor().GetContentAnchor(); - } + if (const SwPosition* pPos = pFlyFormat->GetAnchor().GetContentAnchor()) + aPos = *pPos; if (nEndOfExtrasIndex >= bTextNode.GetIndex()) - { if (auto pFlyFormat = bTextNode.GetFlyFormat()) - bPos = *pFlyFormat->GetAnchor().GetContentAnchor(); - } + if (const SwPosition* pPos = pFlyFormat->GetAnchor().GetContentAnchor()) + bPos = *pPos; return aPos < bPos;}); }